Table of Contents

Advanced Searching

Advanced searching is a way to search on multiple fields at the same time with different conditions. Advanced searching and single searching use the same method, but with different settings and posting data.

Installation

In order to use this method the following modules should be included when downloading the grid: Common, Form Edit, filter Plugin. For more information refer to Download.

Calling Conventions

<script>
... 
jQuery("#grid_id").searchGrid( {multipleSearch:true,...} );
...
</script>

or using the new API

<script>
... 
jQuery("#grid_id").jqGrid('searchGrid', {multipleSearch:true,...} );
...
</script>

Where

To set more advanced search do:

<script>
... 
jQuery("#grid_id").jqGrid('searchGrid', {multipleSearch:true,...} );
...
</script>

Typically when this method is called it launches the modal dialog and makes it so the grid inaccessible until the dialog is closed.
This method is not the default search method in the navigator. To enable this you should either set the default search options using the extend method or set it in the navigator in the place of the search options.

The advanced searching can look like this when created:

Advenced Searching

As you can see the user can add or delete an unlimited number of conditions to perform the search.
To add a condition the plus button should be pressed.
To delete a condition the minus button should be pressed.

Options

We have the same options as those from Single Searching
Below we consider only these options that are connected with the advanced search.
As mentioned above the first option is

The second option is:

When the search data is posted to the server we add only one parameter (again with _search=true) to the url and this is the filters element.
The posted data can look like this:

filters = 
   {
    "groupOp":"OR",
    "rules":[{"field":"a.id","op":"eq","data":"1"}],
    "groups":[
         {
             "groupOp":"AND",
             "rules":[{"field":"a.id","op":"eq","data":"2"}],
             "groups":[...]
         }
     ]
}

The posted data is a JSON string with the following parameters: