How to get jqGrid current search criteria?

孤人 提交于 2019-12-10 12:40:43

问题


I need to get the exact same thing the jqGrid passes on the GET/POST _search parameter.

How can I do this?


回答1:


Just to close this question I did this this the following line:

grid.getGridParam("postData").filters;

With this I get the filter expression the jqGrid generates when we're applying filters on its data.




回答2:


$('#myGrid').getGridParam("postData").filters;

will give you a string (i don't know why string. why not JSON)

"{"groupOp":"AND","rules":[{"field":"Name","op":"bw","data":"a"}]}" 

rules have the search criteria. If i have multiple search criteria, all would be there

"{"groupOp":"AND","rules":[{"field":"Name","op":"bw","data":"a"},{"field":"Description","op":"bw","data":"d"}]}" 



回答3:


var search = grid.getGridParam("postData").search;

...works for me.



来源:https://stackoverflow.com/questions/6217499/how-to-get-jqgrid-current-search-criteria

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