【问题标题】:How to get search operation parameter in server side in jqGrid?jqGrid如何获取服务器端的搜索操作参数?
【发布时间】:2014-10-16 03:52:16
【问题描述】:

我已在 id 过滤框 5 中输入,并在搜索操作中选择了更大。我在服务器端获得了一个 id=5 值,但我无法为搜索运算符获得 value()

    jQuery("#list451").jqGrid({
    url: 'localset.do',
    datatype: "json",
    height: 255,
    width: 600,
    colNames: ['id', 'name', 'Code'],
    colModel: [{
        name: 'item_id',
        index: 'item_id',
        width: 65,
        sorttype: 'integer',
        searchoptions: {
            sopt: ['eq', 'ne', 'le', 'lt', 'gt', 'ge']
        }
    }, {
        name: 'name',
        index: 'name',
        width: 150,
        sorttype: 'string',
        searchoptions: {
            sopt: ['eq', 'bw', 'bn', 'cn', 'nc', 'ew', 'en']
        }
    }, {
        name: 'item_cd',
        index: 'item_cd',
        width: 100
    }],
    rowNum: 50,
    rowTotal: 200,
    rowList: [20, 30, 50],
    loadonce: false,
    mtype: "GET",
    rownumbers: true,
    rownumWidth: 40,
    gridview: true,
    pager: '#pager451',
    sortname: 'item_id',
    viewrecords: true,
    sortorder: "asc",
    caption: "Loading data from server at once"
});
jQuery("#list451").jqGrid('filterToolbar', {
    searchOperators: true
});

我试过postdata:{ filters: JSON.stringify(searchOper) }

我正在使用 jsp servlet。

请求查询字符串为:

&page=&_search=false&nd=1408689334839&rows=10&page=1&sidx=&sord=asc&id=5

如何获取id搜索运算符值?

请帮忙。

【问题讨论】:

    标签: jquery jsp jqgrid jqgrid-php


    【解决方案1】:

    您应该使用filterToolbarstringResult: true 选项。目前,您使用的旧版表单只发送搜索选项的名称和值。在 jqGrid 中随处使用的最新格式描述为here。结果,有关过滤器和操作的所有信息都将作为一个 filters 参数发送。

    在我的所有生产代码中,我总是在 filterToolbarmultipleSearch: true(或 multipleSearch: truemultipleGroup: true)中使用 stringResult: true 选项。为了在任何地方简化这些选项的使用,我设置了我最喜欢的搜索/过滤选项,包括如下行

    $.extend(true, $.jgrid.search, {
        jqModal: false,
        multipleSearch: true,
        multipleGroup: true,
        recreateFilter: true,
        closeOnEscape: true,
        searchOnEnter: true,
        overlay: 0,
        stringResult: true,
        defaultSearch: "cn"
    });
    

    直接在包含grid.locale-en.jsjquery.jqGrid.min.js 之后。

    你当然必须调整你的服务器代码来解析filters参数。

    【讨论】:

    猜你喜欢
    • 2015-07-27
    • 1970-01-01
    • 1970-01-01
    • 2014-01-19
    • 1970-01-01
    • 1970-01-01
    • 2018-11-17
    • 2014-11-18
    • 1970-01-01
    相关资源
    最近更新 更多