Reputation: 21
In a GWT celltable I have many rows associated with CheckboxCell.I need to know only the values of the selected checkboxes on a particular event.
Upvotes: 2
Views: 2854
Reputation: 12296
you need to use SingleSelectionModel or MultiSelectionModel with ProvidesKey implementation (to return unique keys)
SelectionModel selectionModel = new MuliSelectionModel<T>(new ProvidesKey><T>() {
@Override
public Object getKey(T item) {
// return unique key here
}
});
then you assign it to celltable
table.setSelectionModel(selectionModel);
then you can simply invoke selectionModel.getSelectecSet() and it will return Set of objects which are selected in table.
Set<T> selectedObjects = selectionModel.getSelectedSet();
HTH
Upvotes: 1