Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7742961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:24:40+00:00 2026-06-01T09:24:40+00:00

How do I capture the values for the fields searched on in the jqGrid

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T09:24:42+00:00Added an answer on June 1, 2026 at 9:24 am

    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

    jQuery("#grid_id").jqGrid('filterToolbar', {stringResult: true});
    

    The filter parameters get submitted as a json String with the following format

    {"groupOp":"AND", // the group operation when you have multiple feilds to search on
    "rules":[
        {"field":"countrycode", // the field / columns being searched on
          "op":"bw", // operator for searching, here bw mean beginning with
          "data":"ind”}] // the search string for the above field
    }
    

    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

    @RequestMapping(value= "/cityData", method = RequestMethod.POST)
         public @ResponseBody PageResponse getCityList(@RequestParam("page") int pageNo,
                                                      @RequestParam("rows") int rowLimit,
                                                    @RequestParam("sidx") String sortCol,
                                                    @RequestParam("sord") String sortDir,
                                                    @RequestParam("_search") boolean search,
    
    //captures the filter parameters as a json string                                       
        @RequestParam(value="filters",required=false) String filters)
    

    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

    jQuery("#grid_id").jqGrid('filterToolbar', {stringResult: false});
    

    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

     @RequestMapping(value= "/cityData", method = RequestMethod.POST)
         public @ResponseBody PageResponse getCityList(@RequestParam("page") int pageNo,
                                                      @RequestParam("rows") int rowLimit,
                                                    @RequestParam("sidx") String sortCol,
                                                    @RequestParam("sord") String sortDir,
                                                    @RequestParam("_search") boolean search,
    
        //capturing the search string for the country code column                                           @RequestParam(value="countryCode",required=false) String countryCode,)
    

    Hope this helps some one !!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form with about 20 input fields. I capture values of these
I'm using SharpPcap to capture packets. I'm trying to get Traffic Class value and
How do you capture submitted values from a form and displayed them back on
how to capture all fields in the $_POST VARIABLE? into an array? $email =
I am using a form field to capture stats of a particular situation. I
This should tokenize space delimited fields in the string str: float values[2*linesnum(str, length)]; char
How to capture greps return value in an if statement for use inside block
I want to capture as a bitmap the system cursor on Windows OSes as
How can I capture a tab entered in a Silverlight TextBox and render 4
I wanted to capture whether a modifier key was being pressed during application startup

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.