Skip to content

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

Open
@CrisVnait

Description

@CrisVnait

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions