我正在使用GXT 3.0并且每行都有一个带有多个复选框的网格。这些复选框反映了我的行数据的某些属性,并且签入/取消选中并不意味着选择/取消选择特定行。如何在每个复选框中添加一个监听器并在单击它时执行某些操作?
答案 0 :(得分:1)
我重写handleSelection()方法以捕获check / uncheck事件
CheckBoxCell checkCol = new CheckBoxCell() {
@Override
public boolean handlesSelection() {
//TODO:
return true;
}
};
答案 1 :(得分:0)
为每个复选框添加一些CheckBoxSelectionModel
IdentityValueProvider<Stock> identity = new IdentityValueProvider<Stock>();
SpecialRowClickCheckBoxSelectionModel<Stock> sm =
new SpecialRowClickCheckBoxSelectionModel<Stock>(identity);
public class SpecialRowClickCheckBoxSelectionModel<M>
extends CheckBoxSelectionModel<M> {
public SpecialRowClickCheckBoxSelectionModel(
IdentityValueProvider<M> identity) {
super(identity);
}
@Override
protected void handleRowClick(RowClickEvent event) {
M model = listStore.get(event.getRowIndex());
//TODO
}
}