Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
wiki:singe_searching [2011/06/19 08:49] tony |
wiki:singe_searching [2018/02/02 20:55] (current) admin |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ~~ODT~~ | ||
====== Single field searching ====== | ====== Single field searching ====== | ||
Single field searching is a way to search data (at server) on one field at a time. When using this method we construct a modal form where the user can select a field and condition to apply the search. | Single field searching is a way to search data (at server) on one field at a time. When using this method we construct a modal form where the user can select a field and condition to apply the search. | ||
{{ :wiki:simplesearch2.png | Singe Field serching}} | {{ :wiki:simplesearch2.png | Singe Field serching}} | ||
+ | |||
This method uses the url to post the search data and differ from the custom and toolbar search methods. The difference is that the posted search data is not in pair name:value. See below how data is posted. | This method uses the url to post the search data and differ from the custom and toolbar search methods. The difference is that the posted search data is not in pair name:value. See below how data is posted. | ||
Line 16: | Line 15: | ||
... | ... | ||
</script> | </script> | ||
+ | |||
</code> | </code> | ||
or using the new API | or using the new API | ||
Line 64: | Line 64: | ||
Find: "Find", | Find: "Find", | ||
Reset: "Reset", | Reset: "Reset", | ||
- | odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'], | + | odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'] |
- | groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ], | + | |
- | matchText: " match", | + | |
- | rulesText: " rules" | + | |
}, | }, | ||
... | ... | ||
Line 75: | Line 72: | ||
|afterShowSearch|function|This event fires (if defined) every time after the search dialog is shown|null| | |afterShowSearch|function|This event fires (if defined) every time after the search dialog is shown|null| | ||
|beforeShowSearch|function|This event fires (if defined) every time before the search dialog is shown|null| | |beforeShowSearch|function|This event fires (if defined) every time before the search dialog is shown|null| | ||
- | |drag|boolean|Enables or disables draging of the modal|true| | ||
- | |caption|string|The caption of the modal|see lang file| | ||
|closeAfterSearch|boolean| If set to true this closes the search dialog after the user apply a search - i.e. click on Find button|false| | |closeAfterSearch|boolean| If set to true this closes the search dialog after the user apply a search - i.e. click on Find button|false| | ||
|closeAfterReset|boolean| If set to true this closes the search dialog after the user apply a reset - i.e. click on Reset button|false| | |closeAfterReset|boolean| If set to true this closes the search dialog after the user apply a reset - i.e. click on Reset button|false| | ||
- | |closeOnEscape|boolean|If set to true the dialog is closed when the user pres ESC key|false| | + | |drag|boolean|Enables or disables draging of the modal|true| |
+ | |jqModal|boolean|If set to true uses jqModal plugin (if present) to creat the dialogs. If set to true and the plugin is not present jqGrid uses its internal function to create dialog|true| | ||
+ | |resize|boolean|Enables or disables resizing of the modal|true| | ||
+ | |modal|boolean|Is set to true the search dialog becomes modal|false| | ||
+ | |width| integer|Defines the width os the search dialog| 450| | ||
+ | |height| mixed| Defines the height of the search dialog| auto| | ||
+ | |top| integer|the initial top position of modal dialog. The default value of 0 mean the top position from the upper left corner of the grid. When jqModal option is true (see below) and jqModal plugin is present any value different from 0 mean the top position from upper left corner of the window.|0| | ||
+ | |left| integer|the initial left position of modal dialog. The default value of 0 mean the left position from the upper left corner of the grid. When jqModal option is true (see below) and jqModal plugin is present any value different from 0 mean the left position from upper left corner of the window.|0| | ||
+ | |caption|string|The caption of the modal|see lang file| | ||
+ | |showQuery| boolean| If set to true shows the query which is generated when the user defines the conditions for the search. Valid only in advanced search. Again with this a button near search button appear which allows the user to show or hide the query string interactively | false| | ||
+ | |searchOnEnter| boolean|Determines whether search should be applied on pressing Enter key.| false| | ||
|Find|string|The text in the find button|see lang file| | |Find|string|The text in the find button|see lang file| | ||
- | |groupOps|array| translations strings used in advanced searching|see lang file| | ||
- | |matchText|string| Translation text used in advanced searching|see lang file| | ||
|multipleSearch|boolean|If set to true this activates the advanced searching|false| | |multipleSearch|boolean|If set to true this activates the advanced searching|false| | ||
- | |cloneSearchRowOnAdd|boolean| The option is valid only if multipleSearch is set to true. If set to false the cloned (added row when plus button is clicked) row is blank as opposite to true where the row is copied|true| | + | |multipleGroup|boolean|If set to true this activates the advanced searching with a possibilities to define a complex conditions |false| |
|odata|array|Translation strings that corresponds to the sopt options|see lang file| | |odata|array|Translation strings that corresponds to the sopt options|see lang file| | ||
|onClose|function|If defined this event fires when the dialog is closed. Can return true or false. If the event return false the dialog will not be closed|null| | |onClose|function|If defined this event fires when the dialog is closed. Can return true or false. If the event return false the dialog will not be closed|null| | ||
+ | |afterRedraw| function| This function if defined is lunched every time the filter is redrawed - the filter is redrawed every time when we add or delet rules or fields Tio this function we pass the search parameters as parameter | null| | ||
+ | |onSearch|function|If defined this event fires when the search Button is clicked.|null| | ||
+ | |onReset|function| If defined this function fire if reset button is activated |null| | ||
+ | |closeOnEscape| boolean | If this option is set to true the search dialog will be closed if the user press ESC key|false| | ||
|onInitializeSearch|function|This event occurs only once when the modal is created|null| | |onInitializeSearch|function|This event occurs only once when the modal is created|null| | ||
- | |recreateFilter|boolean|When set to true the entry filter is destroyed unbinding all the events and it is constructed again. Use this option if you change dynamically some properties in colModel, so that they have effect|false| | + | |recreateForm| boolean | when set to true the form is recreated every time the search dialog is activated with the new options from colModel (if they are changed)|false| |
+ | |showOnLoad|boolean| This option is valid only in navigator options. If set to true the dialog appear automatically when the grid is constructed for first time| false| | ||
+ | |errorcheck| boolean | if searchrules are defined this turn on of error checking. If there is a error in the input the filter is not posted to the server and a error message appear.|true| | ||
|Reset|string|The text for the clear (reset) button|see lang file| | |Reset|string|The text for the clear (reset) button|see lang file| | ||
- | |rulesText|string|Translation text used in advanced searching|see lang file| | ||
|sField|string|See //sopt// description|searchField| | |sField|string|See //sopt// description|searchField| | ||
|sFilter|string|Aplicable to advanced searching. See advanced [[:wiki:advanced_searching | searching]] |filters| | |sFilter|string|Aplicable to advanced searching. See advanced [[:wiki:advanced_searching | searching]] |filters| | ||
|sOper|string|See //sopt// description|searchOper| | |sOper|string|See //sopt// description|searchOper| | ||
- | |sopt|array|Use this option to set common search rules. If not set all the available options will be used. All available option are: ['eq','ne','lt','le','gt','ge','bw','bn','in','ni','ew','en','cn','nc'] The corresponding texts are in language file and mean the following: ['equal','not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'] Note that the elements in sopt array can be mixed in any order.| | | + | |sopt|array|Use this option to set common search rules. If not set all the available options will be used. All available option are: ['eq','ne','lt','le','gt','ge','bw','bn','in','ni','ew','en','cn','nc','nu','nn'] The corresponding texts are in language file and mean the following: ['equal','not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain','is null','is not null'] Note that the elements in sopt array can be mixed in any order.| | |
|sValue|string|See //sopt// description|searchString| | |sValue|string|See //sopt// description|searchString| | ||
- | |overlay|integer|If this option is set to 0 the overlay in grid is disabled and the user can interact with the grid while search dialog is active |true| | + | |overlay|integer|If this option is set to 0 the overlay in grid is disabled and the user can interact with the grid while search dialog is active | 10 | |
+ | |layer| string| If defined this should be a valid id in the DOM. Also if this option is set the filter is inserted as child of this element| null| | ||
+ | |tmplNames| array| Defines the name of the templates used for easy user input - by example like this : ['Template1', 'Template2',...]. See grid demo how to define templates.| null| | ||
+ | |tmplFilters|array of objects | if defined this should correspond to the tmplNames. See demo how to define template| null| | ||
+ | |tmplLabel| string| If a template is defined a select element appear between the Reset and Find buttons. This is a the text describing the select |Template:| | ||
+ | |zIndex|integer|The starting z-index for the dialog. If you will see the dialog form under another elements or dialogs you should use the parameter with some value higher as default value 950. In the most cases it should be the value higher as 1000 - the default value of jQuery UI dialog.|950| | ||
- | \\ \\ | ||
As mentioned above posting search data differs from custom and toolbar searching. When the find button is clicked, jqGrid adds three parameters to the url (again with _search=true), in name=value pairs: | As mentioned above posting search data differs from custom and toolbar searching. When the find button is clicked, jqGrid adds three parameters to the url (again with _search=true), in name=value pairs: | ||
* sField: the 'searchField', the value comes from the index in colModel | * sField: the 'searchField', the value comes from the index in colModel | ||
Line 110: | Line 122: | ||
{{section>search_config#colmodel_options}} | {{section>search_config#colmodel_options}} | ||
+ | {{section>search_config#colmodel_conventions}} |