将选择侦听器添加到 GXT 网格?
我正在尝试向我的 GXT (Ext GWT) 网格添加一个选择侦听器,但我似乎无法启动它。我尝试了很多变体,但没有运气:
myGrid.addListener(Events.Select, new SelectionListener<ComponentEvent>() {
@Override
public void componentSelected(ComponentEvent ce) {
System.out.println("selected");
}
});
I'm trying to add a selection listener to my GXT (Ext GWT) Grid, but I can't seem to get it to fire. I've tried many variations of this with no luck:
myGrid.addListener(Events.Select, new SelectionListener<ComponentEvent>() {
@Override
public void componentSelected(ComponentEvent ce) {
System.out.println("selected");
}
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
试试这个代码
Try this code
将此答案升级到 GXT v3
To upgrade this answer to GXT v3
尝试:
如有必要,将 ModelData 替换为您的模型类型。
Try:
Replacing ModelData with your model type if necessary.
似乎已经找到了解决方法:
似乎您只需对其进行通用,然后您可以检查 ComponentEvent 并将其转换为 GridEvent。
Seemed to have found a workaround for this:
Seems like you just have to be generic about it, then you can check and cast your ComponentEvent to a GridEvent.
你使用GXT 2.x版本吗?你检查一下所需的事件是否被下沉了吗?例如像
grid.sinkEvents(Event.ONCLICK | Event.ONDBLCLICK | Event.MOUSEEVENTS);
Do you use GXT 2.x version ? Did you check whether required events are sinked? for example like
grid.sinkEvents(Event.ONCLICK | Event.ONDBLCLICK | Event.MOUSEEVENTS);