Is there an easy way to create a data grid, where when the user selects a
row to select it. Then, when the user selects the same row again, the row
will deselect?
I have been trying to use a NoSelectionModel and keeping the last selected,
but you aren't able to use selectionModel.setSelected(object, false) inside
the event.
Here is my code:
selectionModel = new NoSelectionModel<Object>();
selectionModel.addSelectionChangeHandler(new
SelectionChangeEvent.Handler() {
Object lastSelected = null;
@Override
public void onSelectionChange(SelectionChangeEvent event) {
Object selected = selectionModel.getLastSelectedObject();
if(!selected.equals(lastSelected)) {
// call to method that we have a new selected object
} else {
selectionModel.setSelected(selected, false);
}
lastSelected = selected;
}
});
setSelectionModel(selectionModel);
Any help would be appreciated, thanks!
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/G0JRMexoTo4J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.