I have a SelectItem whose picklist is bound to a DataSource. I create the item and then its value programatically. All seems to work except that when I set the value programatically the ChangedHandler on the SelectItem *is not* called. However, the ChangedHandler on the SelectItem *is* called when I change the value manually using the items picklist.
Here is my code:
I would have expected either both or second of the 2 calls to selectItem.setValue(...) to call the ChangedHandler but neither did that.
What am I missing here? Thanks.
Here is my code:
Code:
final SelectItem selectItem = new SelectItem();
selectItem.setTitle("Selection");
selectItem.setDisplayField("Name");
selectItem.setValueField("id");
DataSource dataSource = ...
String url = ...
dataSource.setDataURL(url);
selectItem.setOptionDataSource(dataSource);
selectItem.addChangedHandler(new ChangedHandler() {
public void onChanged(ChangedEvent event) {
SC.say("In ChangedHandler");
}
});
selectItem.setValue("id1");
selectItem.setValue("id2");
What am I missing here? Thanks.
Comment