我在GWT中有一个CellList,我需要在没有使用selectionchange处理程序的情况下单击一个链接时取消选择单元格。在这种情况下可以有人帮忙。
CellList<MyClass> cellList;
SingleSelectionModel<MyClass> lSelectionModel;
final SingleSelectionModel<MyClass> lSelectionModel =
new SingleSelectionModel<MyClass>();
this.cellList.setSelectionModel(lSelectionModel);
public void setSelected(final MyClass pClass) {
Anchor lLink = new Anchor();
lLink.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent pEvent) {
//Here i need to deselect the cell(Myclass)
}
});
}
提前致谢,
拉吉
答案 0 :(得分:1)
使用SingleSelectionModel
就像:
lLink.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent pEvent) {
MyClass selected = lSelectionModel.getSelectedObject();
if (selected != null) {
lSelectionModel.setSelected(selected, false);
}
});