-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correct behaviour of CheckBoxController with values #59
Conversation
@@ -132,7 +140,7 @@ public void refresh(CheckBox checkbox, int index) { | |||
Set<Object> modelValues = retrieveModelValues(); | |||
checkbox.setChecked( | |||
modelValues.contains( | |||
areValuesDefined() ? checkbox.getText() : index | |||
!areValuesDefined() ? checkbox.getText() : values[index] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the exact issue you're trying to solve? The current behavior is already the same as SelectionController
as far as I can tell.
The current implementation is based on the documented behavior (see comments in the constructor). Specifically, if the useItemsAsValues
param that is passed in to the constructor is false
, the CheckBoxController
will represent the selected fields using the 0-based index (as in integer). When you want to read the values in your UI, you can perform the index-to-value mapping if needed.
Let me know if I'm missing something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, basically the problem is that my values are not my text of the checkbox, since sometimes I might have a checkbox with value a and translated title of a. I see your point that the 0-based index muss be supported, so I updated the PR
Update PR, is it now ok? :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense now. Thanks for the fix!
Note that I've released version 0.4.2 that includes your fix. |
When passing a array of values, CheckboxController was having wrong. Now it's doing like SelectionController