ComboBoxItem.setOptionDataSource & sort

Hi,

        ComboBoxItem item = new ComboBoxItem("item");
        item.setOptionDataSource(DS.getInstance());
        item.setDisplayField("name");
        item.setValueField("id");

How to set sort by name for above drop-down combobox ?

There is something like pickListProperties mentioned in the Smartclient docs, but I have no idea how to use it in smartgwt.

Or item.setPickListCriteria is the way to go ?

MichalG

You could use pickListProperties via JSNI. If you don’t understand how to do so, consider also operationOperationId (inherited from FormItem) in conjunction with an override of transformRequest() that sets sortBy on the DSRequest when DSRequest.operationId has the value you set on this ComboBox.

We’ll add an SGWT shortcut for this.

Thanks.
I found out that:

DSRequest dsr = new DSRequest();
dsr.setSortBy("name");
item.setPickListCriteria(dsr);

do what I wanted.
MichalG