Jqgrid列默认过滤不起作用

时间:2014-03-12 12:48:47

标签: javascript jquery asp.net-mvc-4 jqgrid mvcjqgrid

我有一个有3列的Jqgrid。我想在Jqgrid加载时过滤状态:活动记录。

目前它正在加载所有记录。下面是我的ColModel

       $("#Grid").jqGrid({
        url: Link,
        datatype: 'xml',
        cache: false,
        mtype: 'POST',            
        width: 610,
        height: '100%',
        colNames: ['Manager','User','Status'],
        colModel: [
                   {name: 'Manager', index: 'Manager', width: 20, xmlmap: 'Manager', stype: 'select', searchoptions: {dataUrl: DataURL} }, 

                 { name: 'User', index: 'User', width: 20, xmlmap: 'User'},

                 { name: 'Status', index: 'Status', width: 17, xmlmap: 'Status', 
                   stype:'select', searchoptions: { 
    defaultValue: "ACTIVE", value:":ALL;ACTIVE:ACTIVE;INACTIVE:INACTIVE;PENDING:PENDING" }},],

       xmlReader: { repeatitems: false },
        pager: '#pager',
        rowNum: 10,
        scrollOffset: 0,
        cmTemplate: { sortable: true },
        sortname: 'invid',
        sortorder: 'desc',
        viewrecords: true,
        gridview: true,
        loadonce: true,
        shrinkToFit: true,
        scroll: false,

如果我使用defaultValue:“ACTIVE”它将选择值设置为活动但数据未过滤。

我尝试过像下面这样过滤但是没有用。

       filters: {
           "groupOp":"AND","rules": [{ "field": "Status", "op": "eq", "data": "ACTIVE"  }, { "field": "Manager", "op": "eq", "data": "ALL" }]},

搜索:true,

默认情况下如何过滤数据状态为ACTIVE。

1 个答案:

答案 0 :(得分:0)

您的过滤器配置应如下面的分页器/页脚工具栏

  {
                     multipleGroup: true,
                     closeOnEscape: true,
                     caption: "Search...",
                     multipleSearch: true,
                     Find: "Find",
                     Reset: "Reset",
                     odata: [{ oper: 'eq', text: 'equal' }, { oper: 'ne', text: 'not equal' }, { oper: 'lt', text: 'less' }, { oper: 'le', text: 'less or equal' }, { oper: 'gt', text: 'greater' }, { oper: 'ge', text: 'greater or equal' }, { oper: 'bw', text: 'begins with' }, { oper: 'bn', text: 'does not begin with' }, { oper: 'in', text: 'is in' }, { oper: 'ni', text: 'is not in' }, { oper: 'ew', text: 'ends with' }, { oper: 'en', text: 'does not end with' }, { oper: 'cn', text: 'contains' }, { oper: 'nc', text: 'does not contain' }],
                     groupOps: [{ op: "AND", text: "all" }, { op: "OR", text: "any" }],
                 }
相关问题