Hi, we're currently running smartgwt 6.0 from 2017. A common usecase for us is a combobox with lots of values, and we want the user to be able to dynamically type and match the row to select. The value we want out is an integer, the primary key to work with in the datasource.
However, this made it complex to know when a unique row has been selected, since sometime it's selected with the mouse, and sometimes the user types until there is only one row 'left'.
To know when we actually should perform an action when a unique row has been selected, i have a fairly complex handler method, see below. My questions are basically:
1. is there a better way to do this in later versions? For example something like "distinctRowSelectedHandler" or something...
2. Can you see any obvious thing i do that can be better?
thoughts appreciated.
However, this made it complex to know when a unique row has been selected, since sometime it's selected with the mouse, and sometimes the user types until there is only one row 'left'.
To know when we actually should perform an action when a unique row has been selected, i have a fairly complex handler method, see below. My questions are basically:
1. is there a better way to do this in later versions? For example something like "distinctRowSelectedHandler" or something...
2. Can you see any obvious thing i do that can be better?
thoughts appreciated.
Code:
public void onChanged(ChangedEvent changedEvent) { Integer value = null; if(changedEvent.getValue()!=null){ try { if (changedEvent.getValue() instanceof Integer) { value = (Integer) changedEvent.getValue(); } } catch (Exception e) {/*do nothing*/} if (value == null) { return; } } //DO STUFF WITH THE ACTUALLY SELECTED ROW IF WE GET HERE }
Comment