如何将 Clickhandler 添加到 cellTable 单元格(或行)
我想在我的 cellTable 的一列上有一个处理程序。该列是一个 ImageResourceCell,我希望当我单击它时,它会删除该行 这是我的代码
Column<MyObject, ImageResource> imageColumn =
new Column<MyObject, ImageResource>(newImageResourceCell()) {
@Override
public ImageResource getValue(MyObject object) {
return Bundle.Util.getInstance().deleteRegexButton();
}
};
cellTable.addColumn(imageColumn,SafeHtmlUtils.fromSafeConstant("<br/>");
,但我不知道如何按照描述插入处理程序 是否可以 ??
欢迎任何建议
谢谢。
I would like to have a handler on a column of my cellTable.The column is an ImageResourceCell and I would that when I click on it, it delete the row
Here is my code
Column<MyObject, ImageResource> imageColumn =
new Column<MyObject, ImageResource>(newImageResourceCell()) {
@Override
public ImageResource getValue(MyObject object) {
return Bundle.Util.getInstance().deleteRegexButton();
}
};
cellTable.addColumn(imageColumn,SafeHtmlUtils.fromSafeConstant("<br/>");
But I didn't know how to insert a handler as described
Is it possible ??
any suggestions are welcome
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
单元格必须声明它们处理的事件,然后浏览器事件可以传递到单元格。
更多信息请参见:http://code.google.com/webtoolkit/doc/latest /DevGuideUiCustomCells.html
注意:这适用于 GWT 2.4,未尝试使用 GWT 2.2。
Cells have to declare the events they handle, then the browser event can be passed to the cell.
More info here: http://code.google.com/webtoolkit/doc/latest/DevGuideUiCustomCells.html
Note: this works with GWT 2.4, did not try with GWT 2.2.
您是否见过在 GWT 中将 clickHandler 添加到 CellTable 中的行? ?
Have you seen Adding clickHandler to row in CellTable in GWT??
CellTable 内置了对处理单击事件的支持。您可以添加一个 CellPreviewHandler,当单击一行时将调用该单元。它将接收事件中的许多项目,例如本机事件、单元格和数据行值。因为它不仅会触发单击事件,所以您需要检查单击事件是否被触发。简单测试事件是否通过:
A CellTable has built in support for handling click events. You can add a CellPreviewHandler that will be called among others when a row is clicked. It will receive a number of items in the event like the native event, cell, and data row value. Because it fires not only for click events you need to check if the click event was fired. Simply test the event passed: