How do I capture the values for the fields searched on in the jqGrid toolbar search ?
I am using Spring 3 MVC for my backend work.
Currently my method signature looks like
public @ResponseBody PageResponse getEmpList(
@RequestParam("page") int pageNo, @RequestParam("rows") int rowLimit,
@RequestParam("sidx") String sortCol, @RequestParam("sord") String sortDir)
How do I modify it to capture the various search parameters, i.e the field(s) that have been searched on and the respective search strings
I am using jqGrid 4.3.1
I am providing an answer to the question I have posed myself.
There are two ways to capture the filter parameters
If you set your stringResult option as true as in
The filter parameters get submitted as a json String with the following format
Then we could decide how to handle the filter parameters from the above JSON String. The recommended method is to use the JSON libraries available that can convert Java objects to JSON Strings and the other way around as well.
In such a case the method signature to handle this will be as
The _search parameter is triggered to a true value by the filter toolbar when a search string is entered
The other approach to handle these filters is to set stringResult option as false as in
By setting this option to false the column / field being searched upon and the search string get passed as name value pairs
So in this case we are searching for countryCode and the string that we are searching for is ind.
So the function signature will change to
Hope this helps some one !!