0

I'm using a custom search button to perform a multiple search. Looking at firebug it seems that there are missing parameters in the request sent to the server

_search true
filters {"groupOp":"AND","rules":[{"field":"name","op":"bw","data":"A"}]}
nd  1307956101759
page    1
rows    20
searchField 
searchOper  
searchString

when I use the the default search button all the parameters are correctly valorized and the search returns the matching rows.

jQuery("#poi_grid").jqGrid({ 
    url:'php/retrieve_pois.php', 
    editurl:'php/edit_pois.php',
    datatype: "json", 
    colNames:['Name', 'Region', 'Type','Website','PDF','Lat','Lon'], 
    colModel:[ 
        {name:'name',index:'name', width:150, search:true, editable:true}, 
        {name:'region',index:'region', width:70, search:true, editable:true}, 
        {name:'type',index:'type', width:70, search:true, editable:true}, 
        {name:'website',index:'website', width:90,sortable:false,search:false, editable:true}, 
        {name:'pdf',index:'pdf', width:150,align:"right",sortable:false,search:false, editable:true}, 
        {name:'lat',index:'lat', width:60, sortable:false,search:false, editable:true}, 
        {name:'lon',index:'lon', width:60, sortable:false,search:false, editable:true},
    ], 
    pager:'#pager',
    rowNum:20, 
    rowList:[20,30,50], 
    sortname: 'name', 
    viewrecords: true, 
    sortorder: "asc",
    height:259,
    onSelectRow: function(id){
        if(id && id!==rowid){
            jQuery('#poi_grid').restoreRow(rowid);  //restore last grid row
            rowid=id;   //save current row ID so that when focus is gone it can be restored
        }
    }
}); 
//Pager
jQuery("#poi_grid").jqGrid('navGrid','#pager',
    {edit:false,add:false,del:false,search:false,refresh:false}
)
//Custom buttons
.navButtonAdd('#pager',{
    caption:"",
    title:"Search", 
    buttonicon:"ui-icon search", 
    onClickButton: function(){ 
        jQuery("#poi_grid").jqGrid('searchGrid', {
            sopt:['eq','ne','cn','bw','bn'],
            multipleSearch:true
        });
    }, 
    position:"last"
 });

I'm doing something wrong... but what? Thank you in advance!

alessiodl
  • 33
  • 1
  • 5

1 Answers1

0

I don't think that something are missing in the request with the exception of sidx=name and sord=asc which will be send but not included in your data.

Because you use multipleSearch:true option of the searchGrid all information about the searching parameters are encoded in the filters parameter corresponds to the documentation. The empty parameters "searchField=", "searchString=" and "searchOper=" used in case of multipleSearch:fasle should be just ignored.

Oleg
  • 220,925
  • 34
  • 403
  • 798
  • sidx and sord are sent... I missed to copy them in my first message, sorry. I'm still managing to find a solution for the multiple search, but I don't understand how (and where) to set filters. May you show me a code example? Thanks – alessiodl Jun 15 '11 at 07:12
  • @alessiodl: You don't wrote exactly what you missing. Probably [the answer](http://stackoverflow.com/questions/5749723/jqgrid-filtering-records/5750127#5750127) or [another one](http://stackoverflow.com/questions/5272850/is-there-an-api-in-jqgrid-to-add-advanced-filters-to-post-data/5273385#5273385) gives you the missing information? If you are searching for something else you should specify it more exactly. – Oleg Jun 15 '11 at 07:23
  • probably I didn't explain the problem so well. Using multipleSearch:true the search function stop working and I don't understand if I need to add something to the grid code reported in the first post. I'm going to check the answers you linked! Thx – alessiodl Jun 15 '11 at 08:13
  • @alessiodl: Sorry, but I still don't understand what you mean. What you mean under "the search function stop working"? What is wrong? Do you implemented the grid filtering on the server side? – Oleg Jun 15 '11 at 08:43