问题是因为选择如果可能的话不要使用选择模型。并为复选框列添加字段更新器。我用过这个:
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();
}
});
这里 gridReport 字段是我的模型类。setCheckb 是保存复选框值的布尔变量的设置器。