PDA

View Full Version : Editor Grid is not loading the data once it is saved or updated



gajendrabang
4 Oct 2009, 7:32 PM
http://74.54.196.178/~ganpati/extjs/

the php file is http://74.54.196.178/~ganpati/extjs/early-call.phps

When I save data, it saves it to db but does not reflect in grid immediately(not everytime). Keep trying to add and it happens.

tubamanu
4 Oct 2009, 11:08 PM
can u explain your problem with some more details....cannot understand it..:(

gajendrabang
5 Oct 2009, 3:11 AM
can u explain your problem with some more details....cannot understand it..:(

Hi,

Go to the above said url and click "Add category". Now add something and save it. It should save the data to db and reload the grid with new data.

But when you save the data (both in "Add category" and inline-edit ) it does not load the saved data and this problem occurs sometimes, not necessarily everytime.

Hope it make senses ?


Regards,

tubamanu
5 Oct 2009, 3:15 AM
think that your problem is, that you refresh your store during save / update process on database. can that be ?
maybe your store refresh is faster then saving/update action on serverside.
if this is your problem, u can avoid it, if u wait until u get a serverresponse when updating/creating a new entry, and then reload your store.

gajendrabang
5 Oct 2009, 3:18 AM
think that your problem is, that you refresh your store during save / update process on database. can that be ?
maybe your store refresh is faster then saving/update action on serverside.
if this is your problem, u can avoid it, if u wait until u get a serverresponse when updating/creating a new entry, and then reload your store.


ya, I tried to add a two second delay before loading the grid and after saving data. but not working properly. Could you please suggest something else.

here is the php file http://74.54.196.178/~ganpati/extjs/early-call.txt

Condor
5 Oct 2009, 3:19 AM
save() is asynchronous, so you'll have to wait until the server responds (which can be a bit tricky, because a save can consist of multiple requests).

Assuming your server sends the correct response to the create, update and/or delete requests you don't need to reload the store at all.

tubamanu
5 Oct 2009, 3:45 AM
think that sending your php script to sleep is not the right way here.....as condor said, u need to wait for response of your server.....

can look like this:



Ext.Ajax.request({
url : saveURL,
success: function ( result, request) {
// when server answers, reloadstore
store.reload();
dlgPopup.destroy();
}
});



if nothing at all helps, u can also call an defer-function using extjs.....but its quite a bit dirty :X

gajendrabang
5 Oct 2009, 3:49 AM
think that sending your php script to sleep is not the right way here.....as condor said, u need to wait for response of your server.....

can look like this:



Ext.Ajax.request({
url : saveURL,
success: function ( result, request) {
// when server answers, reloadstore
store.reload();
dlgPopup.destroy();
}
});

if nothing at all helps, u can also call an defer-function using extjs.....but its quite a bit dirty :X


Ok, I will try with AJAX

Condor
5 Oct 2009, 4:02 AM
FYI, I created a feature request (http://www.extjs.com/forum/showthread.php?t=82055) to help with this problem.

gajendrabang
5 Oct 2009, 4:05 AM
FYI, I created a feature request (http://www.extjs.com/forum/showthread.php?t=82055) to help with this problem.


That's great. Thank you :)

gajendrabang
5 Oct 2009, 8:05 PM
think that sending your php script to sleep is not the right way here.....as condor said, u need to wait for response of your server.....

can look like this:



Ext.Ajax.request({
url : saveURL,
success: function ( result, request) {
// when server answers, reloadstore
store.reload();
dlgPopup.destroy();
}
});

if nothing at all helps, u can also call an defer-function using extjs.....but its quite a bit dirty :X


The probelm with AJAX is that it will save once we are out from the field. What I want is to get all the dirty (unsaved) rows and save them in a single shot using AJAX

tubamanu
5 Oct 2009, 11:03 PM
actually i do not know how to send severel grid rows to server.
maybe this can be a solution, but don't know if its right...

when loading your application, u can add a formpanel. after pressing save button, u fetch all dirty rows and add each row into an hiddenfield and add it to the formpanel. after all dirty rows are added, submit the form to server.