How would I refresh a jqgrid based grid from outside of the grid itself? Within the code for a grid exists the option to call reloadGrid
. However, I want to reload the grid after doing an ajax file upload, outside of the jqgrid code. How could I call reloadGrid
in that context?
I realize I can completely reload the entire page with something like: location.reload();
but that reloads the whole lot and puts me back to the first page of results for a grid and kind of defeats the purpose of using ajax to upload a file in the first place.
Some code:
reloadGrid is called from within jqgrid as follows:
$("#thegrid").trigger("reloadGrid");
but it does nothing when called from within my ajaxupload:
onComplete: function(file, response) {
if (response == 'success') {
//location.reload();
$("#thegrid").trigger("reloadGrid");
}else if (response == 'error') {
alert("Doh!");
}
If I uncomment location.reload()
, the page reloads but with the trigger uncommented (as in the above example) nothing happens at all. So how do I reload this grid?