我正在使用自定义搜索按钮执行多重搜索。 看看firebug,似乎发送到服务器的请求中缺少参数
_search true
filters {"groupOp":"AND","rules":[{"field":"name","op":"bw","data":"A"}]}
nd 1307956101759
page 1
rows 20
searchField
searchOper
searchString
当我使用默认搜索按钮时,所有参数都被正确地定价,搜索返回匹配的行。
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"
});
我做错了什么......但是什么?先感谢您!
答案 0 :(得分:0)
我不认为请求中缺少某些内容,sidx=name
和sord=asc
将会发送但不会包含在您的数据中。
由于您使用searchGrid
的{{3}}选项,所有有关搜索参数的信息都会在filters参数中编码,对应multipleSearch:true。在multipleSearch:fasle
的情况下使用的空参数“searchField =”,“searchString =”和“searchOper =”应该被忽略。