Hi there,
I am using containerDataSource to set the values for selection. In addition I allow null - thus I get blank item in the combobox selection.
My ComboBox instantiation looks like this
ComboBox comboBox = new ComboBox();
comboBox.setTextInputAllowed(true);
comboBox.setNullSelectionAllowed(true);
BeanContainer dataSource = configureCommonDataSource(objectType); // BeanContainer<String, CustomObject>
// bean id resolver is set to CustomObject.getName()
comboBox.setContainerDataSource(dataSource);
But how to provide the null selection as - instead of blank line?
Check ComboBox.setNullSelectionItemId(…), it sets the item that is used when null selected. So add item with caption “-” to container and set it with this method.
Tatu Lund:
Check ComboBox.setNullSelectionItemId(…), it sets the item that is used when null selected. So add item with caption “-” to container and set it with this method.