user889244
user889244

Reputation: 21

Get values of GWT Selected checkbox in Celltable

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

Answers (1)

jdevelop
jdevelop

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

Related Questions