1
所以我的软件显示一个可变的(数据从数据库中抓取并显示),允许用户单击复选框选择数据。GWT - 在FlexTable的一行上实现ClickHandler事件
//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.
}
};
谢谢非常!!!!
谢谢,我试过users.addClickHandler(userRowCheck);但如果我做补充说,当我尝试打开flextable .....程序冻结任何想法? – 404Error
不确定你的意思是'打开'(添加数据?或点击?),但它可能取决于浏览器,FlexTable在某些浏览器(即IE)上已知速度较慢。您可以尝试使用Grid来检查它是否确实是FlexTable速度。 –