I have been trying to get a grid to be updated from the datasource when a button is pushed.
So I have in the click event something like this:
$('#grid').jqGrid('trigger','reloadGrid');
However this does not work and I get an error thrown for unknown method 'trigger'
I have also tried
$('#grid').jqGrid('trigger("reloadGrid")');
How would I execute this function?
jqGrid('clearGridData') . jqGrid('setGridParam', {data: data, page: 1}) . trigger('reloadGrid'); } } }); )};
In this step, we are going to add jqGrid Script and CSS reference to index view. This script is added to project when we add jqGrid Grid from NuGet package. After adding Scripts and Css next we need to add table element for reserve the place where the grid should be created.
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').
$('#grid').trigger( 'reloadGrid' );
This worked for me.
jQuery('#grid').jqGrid('clearGridData'); jQuery('#grid').jqGrid('setGridParam', {data: dataToLoad}); jQuery('#grid').trigger('reloadGrid');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With