| Help setting default column and operator in jqGrid search dialog.
|
nelsonm

msg:4537253 | 8:30 pm on Jan 18, 2013 (gmt 0) | Hi all, This is for all you jqGrid users. I appended a new button to the nav bar to open an alternate search dialog using: function setFilterByCustomer(grid){ $('#'+grid+'_toppager_left').append("<input id='FilterByCustomer' type='button' value='Filter By Customer' style='height:22px; margin-left:5px;'/>"); $('#'+grid+'_toppager_left input#FilterByCustomer').click( function(){ $(grid).jqGrid ('searchGrid', {multipleSearch:true}); }); } |
| All i want to do is have the search dialog pop up with a specific column and operator pre-selected. However, there does not appear to be any option with the searchGrid method that allow for defining a specific column or operator as selected. Is there another way to select a specific column and operator in the search dialog before or after it opens? thanks
|
nelsonm

msg:4537365 | 7:47 am on Jan 19, 2013 (gmt 0) | Ok, i figured it out. If you need to initially preselect and display a specific column, operator and/or a value in a search dialog... 1. For the default search dialog simply add the grid option: | postData:{'filters':{'groupOp':'AND/OR','rules':[{'field':'column','op':'operator','data':''}]}}, |
| to the grid definition. 2. For additional search buttons in the nav bar, use: function setFilterByCustomer(grid){ $('#'+grid+'_toppager_left').append("<input id='FilterByCustomer' type='button' value='Filter By Customer' style='height:22px; margin-left:5px;'/>"); $('#'+grid+'_toppager_left input#FilterByCustomer').click( function(){ $(grid).jqGrid('setGridParam',{postData:{'filters':{'groupOp':'AND/OR','rules':[{'field':'column','op':'operator','data':''}]}}}); $(grid).jqGrid ('searchGrid', {options}) }); } |
| 3. Substitute the bold parts with the appropriate info.
|
|
|