I'm using SmartGWT 2.5 with Java & Mozilla FF 3.6.x. I want to open pickList of ComboboxItem or SelectItem manually that means programatically. Is it possible? It's OK if I need to use JavaScript to achieve this. Any hint or solution is appreciated.
2 Answers
I finally got the answer. Posting it here might be useful to others. I've used
comboxItem.showPicker();
to achieve manual opening of picklist of ComboboxItem
.

- 8,100
- 16
- 64
- 86
-
That doesn't seem to work with SelectItem, though (at least in SmartGWT 2.4). – Paŭlo Ebermann Jul 04 '12 at 17:15
-
@jewbix.cube, can you try `comboboxItem.getPicker().isVisible()`? – RAS Dec 18 '16 at 10:24
-
@RAS tried that but `getPicker()` seems to always return `null`, even though `showPicker()` works. – jewbix.cube Dec 18 '16 at 18:47
-
@jewbix.cube, well in that case, I don't think there is any such method that can give us the state of the comboboxitem. – RAS Dec 19 '16 at 12:17
In SmartGWT 2.4 (I didn't check newer versions), the showPicker()
method of SelectItem does only show an empty div, not the pick list of the select item. (It does work for the ComboBoxItem, as mentioned by RAS' answer).
Some digging into the underlying SmartClient code showed that on the JavaScript side, there is a showPickList()
method which is called when the icon is clicked (or on some other events), but this is not exposed by the Java class.
So I used a piece of JSNI (modified from the source code of SelectItem.showPicker
) to call this method:
public static native void showPickList(SelectItem item) /*-{
var jsItem = item.@com.smartgwt.client.core.DataClass::getJsObj()();
if(jsItem.showPickList) {
jsItem.showPickList();
}
}-*/
Calling showPickList(item)
for any such pick list now opens the picker.

- 73,284
- 20
- 146
- 210