Why there is an empty item added in the ComboBox? How to get only 2 items? No extra empty item.
ComboBox<GroupType> typeSelect = new ComboBox<>();
typeSelect.setId("portfolioGroupTypeSelect");
typeSelect.setItems(GroupType.PortfolioGroup, GroupType.DynamicGroup);
// HasCaption.fillTo(typeSelect, GroupType.class); I tried it as well
typeSelect.addValueChangeListener(new TypeSelectValueChanged());
public enum GroupType implements HasCaption {
PortfolioGroup("PortfolioGroupsWindow.typeSelect.portfolioGroup"),
DynamicGroup("PortfolioGroupsWindow.typeSelect.dynamicGroup");
private final String key;
GroupType(String key) {
this.key = key;
}
@Override
public String getCaption() {
return SalkkuTM.getI18N(key);
}
}
I found the solutions as:-
typeSelect.setEmptySelectionAllowed(false);
It removes the empty item. I found it right after posting the question.