GWT 2.4 我有CheckBoxCell
一个CellTable
. 选中/取消选中复选框后,更改事件会触发两次。我不知道为什么。任何帮助将不胜感激。
private void createTable() {
// Create a CellTable with a key provider.
final CellTable<Contact> table = new CellTable<Contact>(KEY_PROVIDER);
// Add a checkbox column
final CheckboxCell cbCell = new CheckboxCell();
Column<Contact, Boolean> cbColumn = new Column<Contact, Boolean>(cbCell) {
@Override
public Boolean getValue(Contact object) {
System.out.println("method getValue() - " + object.id + " - " + object.checked);
return object.checked;
}
};
cbColumn.setFieldUpdater(new FieldUpdater<Fieldupdater.Contact, Boolean>() {
@Override
public void update(int index, Contact object, Boolean value) {
System.out.println("method update() - " + object.id + " - " + value);
}
});
table.addColumn(cbColumn);
// Push the data into the widget.
table.setRowData(CONTACTS);
// Add it to the root panel.
RootPanel.get("table1").add(table);
}