PDA

View Full Version : How to remove a row from grid



solaris249
12 Jan 2009, 6:23 PM
i have a grid with checkbox plugin that can multi select on grid.now i want to delete multi selected row in grid

This is my handler code for this work:



ArrayList itemForDelete = new ArrayList();

deleteBtn.addSelectionListener(new SelectionListener<ToolBarEvent>() {

public void componentSelected(ToolBarEvent ce) {

itemForDelete.add(deleteCheck.getSelectedItems());
for (int i = 0; i < itemForDelete.size(); i++) {
store.remove((ModelData) itemForDelete.get(i));

}
Info.display("Deleted", "Deleted");
}



thanks.

Michi_de
12 Jan 2009, 11:08 PM
Try to reload, the loader which is bound to your store.
loader.load();

kolli
13 Jan 2009, 6:04 AM
The store.remove will invoke the remove event, which inturn loads the store over again. As you are trying to delete many items. I think, as Muchi said, we should call loader.load() again

EagleEye666666
13 Jan 2009, 9:01 AM
store.remove((ModelData) itemForDelete.get(i));

Note this will only remove the data from the store. (it will not delete anything within a Database. Proxy will catch this data(objects) again).

So if you will do like they said loader.load(); it will reload all objects again from the Proxy

So what you want to do and from where your Grid gets the data? I have successfully implemented remove method (but for one selected object only, cuz using the store ... forces you to implement a rpc call which will remove a list of objects.)

Regards