====== 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 ===== or using the new API Where * grid_id is the id of the already constructed grid * multipleSearch:true activates the advanced searching * ... other options set as name:value pair To set more advanced search do: * multipleGroup:true activates the more advanced search dialog allowing to add complex group conditions 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: {{ :wiki:complexsearch.png |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 [[:wiki:singe_searching#options | Single Searching]] \\ Below we consider only these options that are connected with the advanced search.\\ As mentioned above the first option is * multipleSearch:true - This option activates the advanced searching The second option is: * sFilter - this option determines the name of the posting data. The default value is filters. 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: * groupOp - this determines the rules of the search. Can be AND or OR. This option can be changed from the user with the help of the select box near the Reset button. When the user select all (English variant) the AND is set. When the user selects any the OR is set. * rules - an array with the following options * field - the field property contains the name of the selected index (or name) from colModel * op - determines the condition of the searching. see the sopt in the [[:wiki:singe_searching#options | options]] * data - is the entered data to be searched on * groups - set of other // groupOp, rules // elements to define a complex search query