所以我的软件正在显示一个弹性表(数据是从数据库中抓取和显示的),用户允许点击一个复选框来选择一个数据。
//users is the flextable object.
userCheck = new ClickHandler() {
public void onClick(ClickEvent event) {
CheckBox src = (CheckBox) event.getSource();
for (int i = 1, n = users.getRowCount(); i < n; i++) {
CheckBox box = (CheckBox) users.getWidget(i, 0);
if (!box.equals(src)) {
box.setValue(false, false);
}
}
removeUserButton.setEnabled(src.getValue());
editUserButton.setEnabled(src.getValue());
}
};
上面的代码有效,但现在我正在尝试实现一个操作,而不是用户单击复选框,我希望用户单击一行(表格的哪个单元格)并制作整行(其中用户已选择)要突出显示。所以我在下面实现了这段代码,但到目前为止它不起作用(就像鼠标点击不会注册,我还没有实现颜色的东西......:()。有什么建议吗?
userRowCheck = new ClickHandler() {
public void onClick(ClickEvent event) {
Cell src = users.getCellForEvent(event);
int rowIndex = src.getRowIndex();
System.out.println("Cell Selected: userRowCheck Handler, rowIndex: " + rowIndex);
//This is just to check if this method is even called out. And well, it doesn't.
}
};
非常感谢!!!!