Disable option in Multi-Select Combo BOX

Hi, I would like to know how can I disable multiple options of the list based in a previous value selected?
Example:
If I have a list of cities by state and my condition is that the user can select just one city for each state.
Whenever the user select one city I want to disable the another cities for the same state.

Regards.

It should be possible with setItemEnabledProvider

Perfect, thank you.

Hi, knoobie the Multi-Select Combo does not have setItemEnabledProvider method.

Oh you are right; I mistook it with the APi of other components. It’s currently not provided as of flow-components issue 1458

:wave: Can you modify the list as a workaround? Something like:

Collection<Object> items = new ArrayList<>(Arrays.asList(1, 2, 3));
var dataProvider = new ListDataProvider<>(items);
multiSelectComboBox.setItems(dataProvider);        multiSelectComboBox.addSelectionListener(multiSelectionEvent -> {                multiSelectionEvent.getAddedSelection().forEach(items::remove);             multiSelectionEvent.getRemovedSelection().forEach(items::add);
dataProvider.refreshAll();
});```

Thank you Roman, I will try that.