我有一个Cell Table,其中最后一列是一个复选框。我想添加一个Check-All-Box作为页脚,点击时选择每行的每个复选框。不知怎的,这里不起作用是我到目前为止所得到的:
Column<Object, Boolean> select = new Column<Object, Boolean>(new CheckboxCell()) {
@Override
public Boolean getValue(Object object) {
return msm.isSelected(object);
}
};
select.setFieldUpdater(new FieldUpdater<Object, Boolean>() {
public void update(int index, Object object, Boolean value) {
msm.setSelected(object, value);
}
});
final Header selectAllHeader = new Header(new CheckboxCell()) {
@Override
public Boolean getValue(){
return msm.getSelectedSet().size() == getRowCount();
}
};
selectAllHeader.setUpdater(new ValueUpdater<Boolean>() {
@Override
public void update(Boolean value) {
for (Object o : getVisibleItems) {
msm.setSelected(o, value);
}
}
});
//works
addColumn(select, selectAllHeader);
//does not work
//addColumn(select, HEADER, selectAllHeader);
答案 0 :(得分:0)