user1119283
user1119283

Reputation: 431

GWT: CheckBoxCell and Selection change event

I am using the following constructor to create a checkboxcell in an editable data grid.

CheckboxCell(false, true)

When I use this and click at any place in the row, selection change event does not fire and I am using single selection model .

When I use,

CheckboxCell();

Selection change event fires on the row but, 1) We have click twice to check or uncheck the cell. 2) if we check or uncheck in the checkboxcell, the value will reverted as soon as I click anywhere.

I am trying to figure out the solution, but not successful yet. Any help would be appreciated.

Am using GWT 2.4.0

Upvotes: 2

Views: 2790

Answers (1)

Ankit Singla
Ankit Singla

Reputation: 198

The problem is because of selection if possible do not use selection model. and add field updater for the column of check box. I have used this:

Column< GridReportFields, Boolean > cb = new Column< GridReportFields, Boolean >(new CheckboxCell() ) { 
                    @Override

        public Boolean getValue(GridReportFields object) {
            // TODO Auto-generated method stub
            return object.getCheckb();
        }
    };
    cb.setFieldUpdater(new FieldUpdater<GridReportFields, Boolean>() {

        @Override
        public void update(int index, GridReportFields object, Boolean value) {
            // TODO Auto-generated method stub
            object.setCheckb(value);
            dataGrid.redraw();
        }
    });

here gridReport Field is my model class. and setCheckb is is setter for the boolean variable that holds the value of checkbox.

Upvotes: 2

Related Questions