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 metho开发者_运维百科d 'trigger'
I have also tried
$('#grid').jqGrid('trigger("reloadGrid")');
How would I execute this function?
$('#grid').trigger( 'reloadGrid' );
This worked for me.
jQuery('#grid').jqGrid('clearGridData');
jQuery('#grid').jqGrid('setGridParam', {data: dataToLoad});
jQuery('#grid').trigger('reloadGrid');
Try this to reload jqGrid with new data
jQuery("#grid").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid');
var newdata= //You call Ajax peticion//
$("#idGrid").clearGridData();
$("#idGrid").jqGrid('setGridParam', {data:newdata)});
$("#idGrid").trigger("reloadGrid");
in event update data table
精彩评论