View Full Version : Combobox close on select

31 Aug 2010, 10:23 AM

What determines if a combobox closes as soon as a selection is made, vs all the options remaining visible until the user clicks elsewhere on the screen? I have comboboxes that behave both ways but I can't figure out why.



31 Aug 2010, 1:02 PM
It should close on a selection. If not, something seems to be wrong. Can you plesae post some testcase that shows the issue that the combobox is not closing?

31 Aug 2010, 4:18 PM
Thanks Sven,

I figured it out - there was a ClassCastException in one of the listeners when I was trying to extract the value from the BeanModel / BaseModel etc etc... I was casting to the wrong type (and it could in fact have been either depending on how I constructed the ComboBox). I found that simply calling SelectionChangedEvent.getSelectedItem().get("value") works for either.

One suggestion I have is that GXT could be improved if it safeguarded itself against exceptions when calling listener code that is defined outside of the GXT framework. Listener callbacks should be protected from each other (one listener exception should not cause other listeners to not be invoked) and GXT should protect itself from failing due to exceptions on the listeners. It was this latter point that was causing the combobox not to close correctly.