我正在使用“jqgrid高级搜索对话框”在对话框中使用IN运算符搜索列(此处为ID)。当我在搜索字段中输入逗号分隔值(例如,5,6)时,不会显示任何行。 IN运算符是在客户端实现的还是我必须以不同的方式输入搜索字符串。
以下是重现问题的代码:
<script type="text/javascript">
$(document).ready(function() {
var mydata = [
{id:"1",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"},
{id:"2",invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"},
{id:"3",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"},
{id:"4",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"},
{id:"5",invdate:"2007-10-05",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"},
{id:"6",invdate:"2007-09-06",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"},
{id:"7",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"},
{id:"8",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"},
{id:"9",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"},
{id:"10",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"}
];
var grid = $("#list");
grid.jqGrid({
data: mydata,
datatype: "local",
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[
{name:'id',index:'id', key: true, width:70, sorttype:"int",search:true,key:true},
{name:'invdate',index:'invdate', width:90, sorttype:"date",search:true},
{name:'name',index:'name', width:100,search:true},
{name:'amount',index:'amount', width:80, align:"right",sorttype:"float",search:true},
{name:'tax',index:'tax', width:80, align:"right",sorttype:"float",search:true},
{name:'total',index:'total', width:80,align:"right",sorttype:"float",search:true},
{name:'note',index:'note', width:150, sortable:false,search:true}
],
pager:'#pager',
rowNum: 10,
rowList: [5, 10, 20, 50],
viewrecords: true,
height: "100%",
caption: "search",
ignoreCase:true,
loadonce:true
});
grid.jqGrid('navGrid','#pager',{add:false,del:false,search:true,refresh:false},
{}, // edit options
{}, // add options
{}, //del options
{multipleSearch: true,multipleGroup : true,caption:' Advance Search'} // search options
);
});
</script>