View Full Version : Re-Load Data in Grid Component
georgesq
22 Sep 2008, 9:33 AM
How can i do re-load data in Grid Component? i'm trying this way:
public void loadAll(final Grid<Users> grid) throws Exception {
ExampleUCServiceAsync svc = ExampleUCService.Util.getInstance();
svc.loadUsers(new AsyncCallback<List<Users>>() {
public void onFailure(Throwable caught) {
Window.alert("rpc failure "+caught);
}
public void onSuccess(List<Users> result) {
List<Users> lstUsers = result;
ListStore<Users> lstStore = grid.getStore();
lstStore.add(lstUsers);
Window.alert(lstStore.getLoader().load() == true ? "true" : "false");
}
});
}
But the new data aren't loaded.
tks.
George
gslender
22 Sep 2008, 1:34 PM
not sure exactly what you are tying to do, but you would probably need to store.removeAll() first before adding to the store.
georgesq
22 Sep 2008, 5:07 PM
i want to create a simple CRUD. my problem is when i press a button, i want that the data are reload.
gslender
22 Sep 2008, 5:55 PM
george,
probably best to clearly explain what issues you are having. is it the whole CRUD or just reloading? - I'm now unclear. Normally you would CRUD against the store and the grid will correctly reflect those changes - as that approach works. If you need to update a single record, get the store to give you a record and modify that, then call commit to update the view/store. You would also need to send those changes back to the server - that part is outside the scope of the store and is something you need to manually do however you need to do it.
You will need to post a complete example of what isn't working - your snippet doesn't really help understand what is being used and where the issue might be. A complete stand-alone example is good for both you (learning) and people helping (less guessing).
BTW - try and post in help, not open discussion so that others can also read/help.
cheers,
grant
drenda81
24 Sep 2008, 1:12 PM
About this thread I'm interesting in reloading data from the store but with some conditios (filters). For example if I want to load forum's threads of a specific day I make the remote call passing the date. Then I change the date and I'd like to display in the grid the post of the new date. So I have to reload the data in the grid with the new filter.
Thanks!!
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.