-
Notifications
You must be signed in to change notification settings - Fork 50
Description
I use ChosenValueListBox to dynamically fill a ListBox with Objects at runtime (setAcceptableValues). When i set the option setAllowSingleDeselect(true), I expect the little cross icon to appear as mentioned in the allowSingleDeselect example on http://dev.arcbees.com/gwtchosen/. Of course, I set the first element in the acceptable values to null, because this is needed as stated in the docs and the line of Code in ChosenImpl:
allowSingleDeselect =
options.isAllowSingleDeselect() && optionsList.getLength() > 0
&& "".equals(optionsList.getItem(0).getText());
I managed to work around this issue by setting a list with a null value on creation of the ChosenValueListBox. But this only works for the first time the box is attached to the DOM. When I switch between Views, which are singletons, the cross disappears.
No idea if it's related, but when debugging I can see that after a setAcceptableValues() with a null Element, the empty Element first appears in the DOM, but after the method updateChosenListBox() it's gone.
public void setAcceptableValues(Collection<T> acceptableValues) {
values.clear();
valueKeyToIndex.clear();
ChosenListBox listBox = getChosenListBox();
listBox.clear(false);
for (T nextNewValue : acceptableValues) {
doAddValue(nextNewValue);
}
>>>>updateChosenListBox();
}