问题
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'
});
});
And the html:
<table id="groupsTable"></table>
<div id="pager"></div>
回答1:
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/
I hope it helps you
来源:https://stackoverflow.com/questions/11673042/jqgrid-paging-buttons-work-only-on-one-click