ComboBox with set


I would like to create ComboBox which behaves in the following way:

  • User chooses “none” - null item with caption “none” is selected and combobox displays inputprompt with text “none”. I don’t want to force user to remove “none” text in order to perform filtering.

This is my code:

String chooseItemCaption = “none”;
Integer nullItemId = -1;
ComboBox comboBox = new ComboBox(“MyComboBox”);
comboBox.setInputPrompt(chooseItemCaption );
comboBox.setNullSelectionItemId(nullItemId ); //doesn’t work - null item caption is blank
comboBox.setItemCaption(nullItemId, chooseItemCaption ); //doesn’t work - null item caption is blank

How to solve this problem?