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.
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.SelectionChangeisn’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 exposedHasSelectionHandlersinterfaces, 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.