1

I am new to JQgrid , my problem is my Jqgrid pagination stops after a grid reload. I am highlighting a selected row and maintaining grid page based on given Id.

For Eg : If I select row with Id 45 on page 4 of JQgrid , page is redirected again and selecting same highlighted row and maintaining page 4 .

Problem is when I click pager-previous button it goes to page 3 only not page 2, page 1. Same is the case with pager-forward button, it goes to page 5 but not further.

My Jqgrid code is below-

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



} 
tanuj shrivastava
  • 722
  • 3
  • 9
  • 21

0 Answers0