1

I have typed in id filter box 5 and I have choosen greater in search operations. I got a id=5 value at server end but I can't get the value() for search operator.

    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
});

i have tried postdata:{ filters: JSON.stringify(searchOper) }

I am using jsp servlet.

The request query string is:

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

How to get the id search operator value?

Please Help.

xxbinxx
  • 1,527
  • 11
  • 18

1 Answers1

1

You should use stringResult: true option of filterToolbar. Currently you use legacy form which just send the name and the value of searched option. More recent format used everywhere in jqGrid are described here. As the result all information about the filter and operations will be send as one filters parameter.

I use always stringResult: true option in filterToolbar and multipleSearch: true (or both multipleSearch: true and multipleGroup: true) in all my productive codes. To simplify the usage of such options everywhere I set my favorite searching/filter options by including the line like

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

directly after including grid.locale-en.js and jquery.jqGrid.min.js.

You will have to adjust your server code of course to parse filters parameter.

Oleg
  • 220,925
  • 34
  • 403
  • 798