Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get jqGrid current search criteria?

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

How can I do this?

like image 843
AlexCode Avatar asked Jun 02 '11 16:06

AlexCode


3 Answers

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.

like image 74
AlexCode Avatar answered Nov 07 '22 11:11

AlexCode


$('#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"}]}" 
like image 26
Jhankar Mahbub Avatar answered Nov 07 '22 09:11

Jhankar Mahbub


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

...works for me.

like image 34
Craig Stuntz Avatar answered Nov 07 '22 09:11

Craig Stuntz