在jqGrid搜索中显示“null is operator”错误消息是null运算符

时间:2013-05-08 01:11:22

标签: jqgrid

我正在使用jqGrid高级搜索。我不想搜索空值,因此我在搜索规则(required:true)中为所有字段设置了searchrules:{required:true}。我的问题是我收到“字段是必填的”错误消息,如果我选择null运算符并单击查找弹出窗口中的查找按钮。

$(document).ready(function() {
    var grid = $("#list"),
        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"}
        ];

    grid.jqGrid({
        datatype: "local",
        data: mydata,
        colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
        colModel:[
            {name:'id',index:'id', key: true, width:70, sorttype:"int",searchrules:{required:true}},
            {name:'invdate',index:'invdate', width:90, sorttype:"date",searchrules:{required:true}},
            {name:'name',index:'name', width:100,searchrules:{required:true}},
            {name:'amount',index:'amount', width:80, align:"right",sorttype:"float",searchrules:{required:true}},
            {name:'tax',index:'tax', width:80, align:"right",sorttype:"float",searchrules:{required:true}},
            {name:'total',index:'total', width:80,align:"right",sorttype:"float",searchrules:{required:true}},
            {name:'note',index:'note', width:150, sortable:false,searchrules:{required:true}}
        ],
        search:true,
        pager:'#pager',
        jsonReader: {cell:""},
        rowNum: 10,
        rowList: [5, 10, 20, 50],
        sortname: 'id',
        sortorder: 'asc',
        viewrecords: true,
        height: "100%",
        caption: "Multiple search with local data"
    });
    grid.jqGrid('navGrid','#pager',{add:false,edit:false,del:false,search:true,refresh:true},
                {},{},{},{multipleSearch:true, multipleGroup:true, showQuery: true});
});

HTML CODE

<table id="list"></table>
<div id="pager"></div>

由于

1 个答案:

答案 0 :(得分:0)

在我看来,使用null运算符的要求与规则searchrules: {required: true}相矛盾。规则required: true表示搜索字段的数据不能为空。另一方面null运算符没有数据。