How to change sidx,sord,filters parameters names in jqGrid

后端 未结 1 394
悲哀的现实
悲哀的现实 2020-12-30 15:39

If column names are sidx,sord,filters , jqGrid getting data is broken. I tried to add underscores to them using code below but those parameters are still passed without unde

相关标签:
1条回答
  • 2020-12-30 16:35

    I don't understand what you mean under "If column names are sidx,sord,filters , jqGrid getting data is broken". Nevertheless if you need you can rename or remove the jqGrid parameters with two ways: prmNames and serializeGridData.

    You should carefully examine the list of default values of the prmNames. There are no possibility to rename filters in the way, but to rename the name of other parameters you should use

    $.extend(jQuery.jgrid.defaults, {
        prmNames: {
            id: "_rowid", page: "_page", rows: "_rows",
            oper: "_oper", sort: "_sidx", order: "_sord"
        }
    });
    

    (sort and order instead of sidx and sord). To rename filters to _filters and to remove sending of empty searchField, searchString and searchOper you can do almost the same what I described here:

    serializeGridData: function (postData) {
        var myPostData = $.extend({}, postData); // make a copy of the input parameter
        myPostData._filters = myPostData.filters;
        delete myPostData.filters;
        delete myPostData.searchField;
        delete myPostData.searchString;
        delete myPostData.searchOper;
        return myPostData;
    }
    

    Using Fiddler or Firebug you can verify that in the URL of the demo are used the following parameters

    _search=true&nd=1313235583212&_rows=10&_page=1&_sidx=invdate&_sord=desc&_filters=...
    

    like you as need.

    0 讨论(0)
提交回复
热议问题