Hi,
Is there a simple way to programmatically set the selected index of a SelectItem?
Currently I have (as I mentioned elsewhere before) a ListGrid and SelectItem bound to the same datasource. The only problem I'm having at the moment is that if the record that is selected in the SelectItem is removed from the ListGrid and hence the DataSource then the 'String' value for that record remains as the selected item in the SelectItem. The record itself, is of course removed so
returns null but
returns a String representing that value.
What I would really like to happen is when a value is removed from the ListGrid, if it is the currently selected value in the SelectItem then the first (non-null) item of the SelectItem should be selected instead. Normally I would do this in Java with a call to
but there doesn't appear to be anything similar in SmartGWT.
I am currently trying out various approaches to this within a DataArrivedHandler in the SelectItem where event.getData() returns the correct number of results.
Is there a simple way to programmatically set the selected index of a SelectItem?
Currently I have (as I mentioned elsewhere before) a ListGrid and SelectItem bound to the same datasource. The only problem I'm having at the moment is that if the record that is selected in the SelectItem is removed from the ListGrid and hence the DataSource then the 'String' value for that record remains as the selected item in the SelectItem. The record itself, is of course removed so
Code:
selectItem.getSelectedRecord()
Code:
selectItem.getValue()
What I would really like to happen is when a value is removed from the ListGrid, if it is the currently selected value in the SelectItem then the first (non-null) item of the SelectItem should be selected instead. Normally I would do this in Java with a call to
Code:
setSelectedIndex(0)
I am currently trying out various approaches to this within a DataArrivedHandler in the SelectItem where event.getData() returns the correct number of results.
Comment