PDA

View Full Version : Grid reload after new data submission



SabaSarwat
29 Dec 2010, 1:54 AM
Hello,
I have a grid on west of border layout and a card wizard layout on center of the panel. In center i have form fields. when i submit data (after clicking on submit button), i want grid on west panel to reload at the same time. I saw many threads, but did not find the solution for me. I tried all these...
store.loadData();

store.removeAll();
store.reload();

grid.view.refresh()

grid.getStore().reload();

Kindly help...

Condor
29 Dec 2010, 4:03 AM
I assume the submit changes the store data?

In that case I would recommend returning all the new grid data from the submit request and use it in the success handler call loadData on the grid store.

Alternatively, you could wait until the submit succeeds and then reload the store, but that takes 2 server requests instead of 1.

SabaSarwat
29 Dec 2010, 4:45 AM
Thanks Condor,
by the way i did this and its working fine for me.


var store = Ext.getCmp('Grid').getStore();
store.load.defer(2500, store);

Condor
29 Dec 2010, 4:53 AM
Not the best solution. It's better to wait for the submit to succeed and then to reload.

Now you always wait 2.5 sec, which is often too long, but it can even be too short (if your server is very busy), in which case you will still get the old data.

SabaSarwat
29 Dec 2010, 5:03 AM
Yes you are right... I would do that. Thanks :)