I have a problem with GXT SimpleComboBox which I'm not sure is a bug or a (unexpected) feature. I have the example code below, which should work out of the box if you put it inside onModuleLoad() of your GWT entry point.
I add 10 items to the combo box and whenever I select one of them I get a matching item and item index in the Log.info() statements. However, when one of the items is selected and the combo box loses focus because I temporarily switch to another window (using the Mac version of Alt-Tab) the combo box expands with a single item (the currently selected one). This is illustrated in the following figure
When I go back to the browser window (where the combo box is displayed), the combo box remains selected and expanded with a single item (as in the figure). If I press Enter the Log.info() prints the correct item (Item 5) but not the correct item index (0). It seems that the combo box ListStore suddenly contains only a single item instead of 10.
I do not understand this behavior. If anyone has some ideas about this I would be very glad to hear about it.
final SimpleComboBox<String> comboBox
= new SimpleComboBox<String>(new LabelProvider<String>()
public String getLabel(String s)
for(int i = 0; i < 10; ++i)
comboBox.getStore().add("Item " + i);
public void onSelection(SelectionEvent<String> event)
String item = event.getSelectedItem();
Log.info("selectedItem: " + item);
Log.info("selectedIndex: " + comboBox.getStore().indexOf(item));