jqGrid 分页按钮只需单击一下即可工作

问题描述 投票:0回答:1

我在项目中使用 jqGrid 并遇到了一个奇怪的分页问题。我可以单击下一页按钮并从第 1 页转到第 2 页,但此后我按下的任何其他分页按钮都会卡在第 2 页上并且无法转到其他页面。不过,我可以输入页码,按 Enter 键,然后它将更新显示的页面。我已经粘贴了下面的 jqGrid 代码。

jQuery(document).ready(function(){ 
jQuery("#groupsTable").jqGrid({

  jsonReader: {
       root:"rows",
       page:"page",
       total:"total",
       records:"records",
       repeatitems:false,
       cell:"",
       id:"id",
       userdata:"userdata"
     },
  url:'project/selectTable/loadTableInfo.do',
  datatype:'json',
  colNames:['Name','Size', 'Number', 'Search','Delete'],
  colModel:[
  {name:'name',index:'name', width:500, sorttype:'text', searchoptions:{sopt:['cn']}, 
  {name:'size',index:'size', sorttype:'int', width:150, searchoptions:{sopt:['le']}},
  {name:'mailList',index:'mailList',sorttype:'int', width:150, searchoptions:{sopt:['le']}},
  {name:'search',index:'search', stype:'select', width:60, sortable:false},
  {name:'delete',index:'delete',width:60, stype:'select', sortable:false}],
  pager:'#pager',
  loadonce:true,
  rowNum:50,
  rowList:[10,25,50,75,100,500],
  viewrecords:true,
  height:600,
  pgbuttons:true,
  pginput:true,
  loadComplete: function(){                
    var ids = jQuery("#groupsTable").getDataIDs(); 
    for(var i=0;i<ids.length;i++){ 
      var cl = ids[i]; 
      X = "<span class='delete' onClick=deleteRow("+cl+");></span>"
      searching = "<span class='search' onClick=search("+cl+");></span>"
      jQuery("#groupsTable").setRowData(ids[i],{delete:X});
      jQuery("#groupsTable").setRowData(ids[i],{search:searching});
      }
    jQuery('#groupsTable').filterToolbar({searchOnEnter:false});
    jQuery('#groupsTable')[0].triggerToolbar();
  },
  caption:'General Info'
});
});

还有 html:

<table id="groupsTable"></table> 
<div id="pager"></div> 
pagination jqgrid
1个回答
0
投票

我认为您以错误的方式实现 rowList,请阅读此链接中 rowList 的定义

http://www.trirand.com/jqgridwiki/doku.php?id=wiki:first_grid

或者也可能是版本问题,请检查此链接..

http://www.trirand.com/blog/?page_id=393/help/default-rowlist/

希望对你有帮助

© www.soinside.com 2019 - 2024. All rights reserved.