Vaadin 7.7.12 NativeSelect + setMultipleSelect

Looking in the API-Docs the method setMultipleSelect for the component NativeSelect is valid
but running the code I receive
java.lang.UnsupportedOperationException: Multiselect not supported
at com.vaadin.ui.NativeSelect.setMultiSelect(NativeSelect.java:128)

what’s wrong ?

final KfaNativeSelect nsc = new KfaNativeSelect(“Rechnung eingelangt”);
nsc.setMultiSelect(true);

Thanks
Gerhard

Hi,

there is nothing wrong with your code. The NativeSelect is the extension of AbstractSelect class, which defines the setMultiselect method. As it written in the JavaDoc for it :

Subclasses of AbstractSelect can choose not to support changing the
      multiselect mode, and may throw {@link UnsupportedOperationException.

And that is the case with the NativeSelect, which overriding the setMultiselecting method and throws the UnsupportedOperationException:

 @Override
    public void setMultiSelect(boolean multiSelect)
            throws UnsupportedOperationException {
        if (multiSelect == true) {
            throw new UnsupportedOperationException(
                    "Multiselect not supported");
        }
    }

So, unfortunately, you can’t use the Multiselect mode with the NativeSecelt, but if you still need it you can swith to
ListSelect
component.

Hopefully it helps you forward,

Regards,
Anastasia