gatanaso/multiselect-combo-box-flow

Vaadin 14 - version 2.5.0 - Custom Values are not returned by getValue and getSelectedItems

CrisVnait opened this issue · 0 comments

I enabled adding custom values like:

public class CustomValueStringMultiselectComboBox extends MultiselectComboBox<String> {
    public CustomValueStringMultiselectComboBox(String label) {
        super(label);
        setItems(Collections.emptyList());
        setAllowCustomValues(true);
        addCustomValuesSetListener(e -> {
            LinkedHashSet<String> value = new LinkedHashSet<>(getValue());
            value.add(e.getDetail());
            setItems(value);
            setValue(value);
        });
    }
}

If I try to get values (via binder) it returns an empty list. Here v is during all states an empty collection.

binder.bind(telecommunicationMultiComboBox, d -> {
            telecommunicationMultiComboBox.setItems(d.getTelecommunicationSet());
            return d.getTelecommunicationSet();
        }, (d, v) -> {
            v = telecommunicationMultiComboBox.getSelectedItems();
            d.setTelecommunicationSet(v);
        });

Expected behavior is that custom values are returned.