开发者

How to refresh the data in a jqGrid?

开发者 https://www.devze.com 2023-01-04 20:25 出处:网络
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:

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

0

精彩评论

暂无评论...
验证码 换一张
取 消