PDA

View Full Version : Reload Store after Save -- race condtion



jimtyp
24 Sep 2009, 1:28 PM
I have a grid with paging, and when I remove a record I'd like to have the grid refreshed.
I tried this:


store.save();
store.reload();

But the reload happens first, because save is asynchronous.

Is there a way to listen for an event when the save is complete?

jnicora
24 Sep 2009, 2:04 PM
I have a grid with paging, and when I remove a record I'd like to have the grid refreshed.
I tried this:


store.save();
store.reload();

But the reload happens first, because save is asynchronous.

Is there a way to listen for an event when the save is complete?

i havent used direct yet, but im assuming something like this will work:



store.on("write", function(store, action, result, res, rs){
// if successful etc
grid.getView().refresh(); // neeed handle to grid
});


although im surprised a direct actions callback isnt already triggering a refresh.

eXergo
25 Sep 2009, 1:05 AM
Hi!

I have the same problem. I tried some events ("write", "update", "add"), bur they didn't work. In my store, autoSave value is set to 'false'.

Anyone knows which event fire the 'save' method?