jqGrid分页按钮仅需单击一下即可使用 [英] jqGrid paging buttons work only on one click

查看:227
本文介绍了jqGrid分页按钮仅需单击一下即可使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm using jqGrid in my project and ran into a strange paging issue. I can click on the next page button and go from page 1 to page 2, but any other paging buttons I push after that I get stuck on page 2 and can't go to other pages. I can however type in a page number, hit enter and then it will update the page displayed. I have pasted the jqGrid code below.

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> 

推荐答案

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

what i think you are implementing rowList in wrong manner, read the defination of rowList in this link

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

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

or it could be a version problem also, check this link..

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

希望对您有帮助

这篇关于jqGrid分页按钮仅需单击一下即可使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆