The jqGrid source file I use is listed at the top of the version as jqGrid 4.4.0 , date as Date 2012-06-14
This wiki page says trigger("reloadGrid") ,
Reloads the grid with the current settings. This means that a new request is send to the server if datatype is xml or json. This method should be applied to an already-constructed grid. Pay attention that this method does not change HEADER information, that means that any changes to colModel would not be affected. You should use gridUnload to reload new configuration with different colModel. IT WORK ONLY IF loadonce: false !!!
And yes, he says "ONLY WORKS ONLY IF loadonce: false !!!"
And this SO answer is suggested by some hack for this. It says:
If you use loadonce:true jqGrid change the datatype parameters to 'local' after the first load of data from the grid. All next grid reloading (sorting, paging, filtering) works local. If you want refresh the grid data from the server one more time you should set datatype to its original value ('json' or 'xml').
So, this answer actually solved the problem that I ran into. I had jqGrid with loadonce:true . (I'm worried about sorting here, and it works great). but then I had to change the code a bit to reload jqGrid with new server data. (the user can change some details and update the table so that jqGrid must reload recently acquired data from the server). Unfortunately, this did not work until I changed loadonce:true to loadonce:false .
I called reboot like this,
$("#tableGrid").setGridParam({url:'myUrl'}).trigger('reloadGrid');
Now the reboot was fine. BUT sorting disappeared :(
And then I saw that SO would respond and change it to something like this,
I set loadonce:true when initializing the grid. and is called reboot, as shown below.
$("#tableGrid").setGridParam({url:'myUrl',datatype:'xml'}).trigger('reloadGrid');
after that, all sorting was perfect, and the user could also reload the grid.
Is this approach right? I think he solved the problem , but right? because the documentation says you cannot reload when loadonce:true ?