在JQGrid重新加载并设置自定义页码后,分页会停止吗?

时间:2015-09-21 11:44:08

标签: jquery jqgrid jqgrid-formatter mvcjqgrid

我是JQgrid的新手,我的问题是我的Jqgrid分页在网格重新加载后停止。 我正在突出显示所选行并根据给定的Id维护网格页面。

对于Eg:如果我在JQgrid的第4页上选择Id 45的行,则会再次重定向页面并选择相同的突出显示的行并维护第4页。

问题是,当我点击寻呼机 - 前一个按钮时,它仅转到第3页而不是第2页,第1页。与寻呼机转发按钮的情况相同,它转到第5页但不再进一步。

我的Jqgrid代码如下 -

function bindGroupGrid() {

    $("#GroupListGrid").armCustomGrid(
   {

       url: '../MasterData/GetAllGroup',
       sortname: 'GroupName',
       sortorder: 'asc',
       colNames: ['Id', 'Entity Type', 'Group Name', 'Group Description', 'Is Company', 'Edit'],
       colModel: [
           { name: 'Id', key: true, hidden: true },
           {
               name: 'EntityName', width: 100, align: 'left', index: 'EntityName', searchoptions: { sopt: ['cn'] }, resizable: false
           },
           {
               name: 'GroupName', width: 100, align: 'left', index: 'GroupName', searchoptions: { sopt: ['cn'] }, resizable: false
           },
           {
               name: 'Description', width: 120, align: 'left', index: 'Description', searchoptions: { sopt: ['cn'] }, resizable: false
           },
           {
               name: 'IsCompany', index: 'IsCompany', align: 'left', width: 60, sortable: false,
               formatter: checkboxFormatter, resizable: false, stype: "select",
               searchoptions: { value: ":All;true:Company;false:Individual" }, editoptions: { value: "True:False" }
           },
           {
               name: 'Edit', width: 60, index: 'Edit', align: 'center', sortable: false, search: false,
               formatter: actionFormatterEdit
           }
       ],
       rowNum: 5,
       autowidth: true,
       loadonce:true,
       gridComplete: function () {
           var id = parseInt($("#GroupId").val());
           if (id != null && id != 0) {
               $("#GroupListGrid").trigger("reloadGrid", [{ current: true, page: selectedPage }]).setSelection(id, true);
           }
           else {

           }
       }
   });


    function actionFormatterEdit(cellvalue, options, rowObject) {
        var page = $('#GroupListGrid').getGridParam('page');
        return '<a href="../MasterData/EditGroup?GroupId=' + options.rowId + '&PageNum=' + page + '" class="editIcon"></a>';

    }
    function checkboxFormatter(cellvalue, options, rowObject) {
        if (cellvalue === true) return "Company"; else return "Individual";
    }



} 

0 个答案:

没有答案