ComboBox - want to disable some items

Hello!

I have got a ComboBox (Vaadin 16.0.0.beta2) and want to disable some items inside it.

Is there a way to do this?

In the RadioButtonGroup there is such a solution:

/**
 * Sets the item enabled predicate for this radio button group. The
 * predicate is applied to each item to determine whether the item should be
 * enabled ({@code true}) or disabled ({@code false}). Disabled items are
 * displayed as grayed out and the user cannot select them. The default
 * predicate always returns true (all the items are enabled).
 *
 * @param itemEnabledProvider
 *            the item enable predicate, not {@code null}
 */
public void setItemEnabledProvider(
        SerializablePredicate<T> itemEnabledProvider) {
    this.itemEnabledProvider = Objects.requireNonNull(itemEnabledProvider);
    refreshButtons();
}

Is there a way to do this at the ComboBox?

Thank you very much,
Thomas

Hi,

to the best of my knowledge this is not possible out of the box as of now. It seems achievable with a comboboxrenderer and setting a combobox item to disabled but I have never seen it implemented anywhere yet. See https://github.com/vaadin/vaadin-combo-box/issues/443 and https://github.com/vaadin/vaadin-combo-box/pull/496