1

我在我的项目中使用 jqGrid 并遇到了一个奇怪的分页问题。我可以单击下一页按钮并从第 1 页转到第 2 页,但是在此之后我按下的任何其他分页按钮都会卡在第 2 页并且无法转到其他页面。但是,我可以输入页码,按回车键,然后它会更新显示的页面。我在下面粘贴了 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> 
4

1 回答 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/

希望对你有帮助

于 2012-07-26T16:59:50.947 回答