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 button开发者_StackOverflow中文版s
.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!
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.
精彩评论