当网格单元格中的复选框更改其状态时,我需要更新存储:添加或删除存储中的值。如何处理这个事件?顺便说一句,我以这种方式在网格中创建复选框:
column = new ColumnConfig();
column.setId("accepted");
column.setHeader("Accepted");
column.setWidth(55);
UPD2:现在我执行以下操作:按照最初决定创建复选框:
CheckColumnConfig checkColumn = new CheckColumnConfig("accepted", "", 55);
CellEditor checkBoxEditor = new CellEditor(new CheckBox());
checkBoxEditor.setToolTip("If you click here server will consider this rule checking your messages");
checkColumn.setEditor(checkBoxEditor);
checkColumn.setHeader("apply");
configs.add(checkColumn);
而不是像这样处理网格中的事件: UPD3:
grid.addListener(Events.CellMouseUp, new Listener<GridEvent>() {
@Override
public void handleEvent(GridEvent be) {
PropertyItem item;
if (grid.getStore().getAt(be.getRowIndex()).isAccepted()){
item = new PropertyItem(val1, val2, val3, true);
} else {
item = new PropertyItem(val1, val2, val3, false);
}
store.update(item);
store.commitChanges();
saveProperties(store, customerId, toRemove);
}
});
这是正确的方法。