jqGrid client-side searching

微笑、不失礼 提交于 2019-11-26 15:27:25

You should implement search for single field in a little another way:

var grid = jQuery("#Grid2");
var postdata = grid.jqGrid('getGridParam','postData');
jQuery.extend (postdata,
               {filters:'',
                searchField: 'error_column',
                searchOper: 'eq',
                searchString: 'Test'});
grid.jqGrid('setGridParam', { search: true, postData: postdata });
grid.trigger("reloadGrid",[{page:1}]);

You can see live example here.

UPDATED: You use loadonce: true and datatype: "local" together. The value loadonce: true will be ignored in case of datatype: "local". If you do get the data from the server and use datatype: "json" or datatype: "xml", then loadonce: true will work. If you want that the searching (filtering) will be done not locally but on the server instead you should reset datatype to 'json' or 'xml' as additional option of 'setGridParam'.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!