clearAndLoad After AJAX Post


I have a Grid and a dynamically generated form.
The form prompts the user for a row to be inserted and does a form.send() where my own code adds the row.
After the row is inserted, I do a grid.clearAndLoad() but my new row doesn’t show up.
I need to clear my cookies and reload the page to get the new row to show up.

dpfs.attachEvent("onAfterUpdate",function(sid,action,tid,xml_node){ if(action=="inserted"){ mainGrid.clearAndLoad("include/Query.php?id=" + selectedTable); } });

I can see the data being added in the db, but the XML generated from the Query.php doesn’t list the newly added row.

Any help is appreciated.


try to add a random parameter to the url to avoid caching:

mainGrid.clearAndLoad(“include/Query.php?id=” + selectedTable+"&rs="+(new Date()).valueOf());

Try the following setTimeout(function):

setTimeout(function() {
mainGrid.clearAndLoad(“include/Query.php?id=” + selectedTable);

Change the 100 to whatever length of time you want it to be and you’ll find that this slight delay gives the server and code enough time to process it and return the correct results.