EXT GWT 将所选项目绑定到新的空网格
我使用一个网格来选择项目,使用另一个网格来显示所选项目。我在更新新网格时遇到问题。
在伪代码中:
selectionGrid = new Grid();
selectionGrid.addlistener(new listener {
update();
});
void update() {
targetGrid = new Grid(selectionGrid.getstore().getselecteditems(), columns);
}
我能够第一次更新目标网格,但在新选择后再次更新它时遇到问题。
我应该采取不同的方式吗?
谢谢。
I am using one grid to select items, and another to display the selected items. I am having trouble updating the new grid.
In pseudo code:
selectionGrid = new Grid();
selectionGrid.addlistener(new listener {
update();
});
void update() {
targetGrid = new Grid(selectionGrid.getstore().getselecteditems(), columns);
}
I'm able to update the targetgrid the first time, but have trouble updating it again after a new selection.
Is there a different way I should be doing this?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
差不多就是这样 - 制作两个网格,一个包含原始项目,另一个包含空的
ListStore
。更新调用应该是store.addAll(selected)
,尽管可能首先是store.clear()
。这些方法假设 GXT 3 - 在 GXT 2 中,我认为它是
store.add(selected)
和store.removeAll()
。在 2 中,您可能还会发现Events.SelectionChange
不是由 Grid 触发的,而是由它的SelectionModel
触发的 - 阅读 javadoc 以确保每个类触发哪些事件。在 GXT 3 中,事件由公开的 HasSelectionHandlers 接口明确,表明您可以为选择事件添加处理程序。如果这仍然不起作用,请考虑发布一个几乎可以工作的示例来准确演示您所尝试的内容。
That's pretty much it - make the two grids, one with the original items, the other with an empty
ListStore
. The update call shouldstore.addAll(selected)
, though probablystore.clear()
first.These methods assume GXT 3 - in GXT 2, I think it is
store.add(selected)
andstore.removeAll()
. In 2 you may also find that theEvents.SelectionChange
isn't fired by Grid, but by it'sSelectionModel
- read the javadoc to be sure what events each class fires. In GXT 3, the events are made clear by the exposedHasSelectionHandlers
interfaces, indicating that you can add a handler for selection events.If this still doesn't work, consider posting an almost working example to demonstrate exactly what you've tried.