jqGrid pager stopped working
I've been experimenting with jqGrid 4.1.2 the last couple of days, activating more and more of it's built in functionality along the way. Somewhere along the way the pager stopped working, and I cannot figure out what is wrong. When the grid loads I can see the data for the first page fine, but when I switch pages the data remains the same. Only the counter changes. If I select 100 in the number of rows dropdown-list, I can see all data.
I've compared to the examples at http://www.trirand.com/blog/jqgrid/jqgrid.html and everything seems to match, but I confess I'm not the best JavaScript coder there is. Here's the offending code:
<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
jQuery("#testgrid").jqGrid({
url:'/Main/DynamicGridData/',
mtype:'POST',
datatype:'json',
colNames: [
'CustomerId',
'RecordStartUtc',
'RecordEndUtc',
'Id',
'Name',
'Status',
'AudioTitle',
'ServerId',
'ServerName',
'ApplicationInstanceId',
'ApplicationInstanceName',
'ApplicationName',
'ChannelId',
'ChannelFullName',
],
colModel: [
{ name: 'CustomerId', index: 'CustomerId', width: 0, align: 'left' },
{ name: 'RecordStartUtc', index: 'RecordStartUtc', width: 0, align: 'left' },
{ name: 'RecordEndUtc', index: 'RecordEndUtc', width: 0, align: 'left' },
{ name: 'Id', index: 'Id', width: 0, align: 'left' },
{ name: 'Name', index: 'Name', width: 0, align: 'left' },
{ name: 'Status', index: 'Status', width: 0, align: 'left' },
{ name: 'AudioTitle', index: 'AudioTitle', width: 0, align: 'left' },
{ name: 'ServerId', index: 'ServerId', width: 0, align: 'left' },
{ name: 'ServerName', index: 'ServerName', width: 0, align: 'left' },
{ name: 'ApplicationInstanceId', index: 'ApplicationInstanceId', width: 0, align: 'left' },
{ name: 'ApplicationInstanceName', index: 'ApplicationInstanceName', width: 0, align: 'left' },
{ name: 'ApplicationName', index: 'ApplicationName', width开发者_运维知识库: 0, align: 'left' },
{ name: 'ChannelId', index: 'ChannelId', width: 0, align: 'left' },
{ name: 'ChannelFullName', index: 'ChannelFullName', width: 0, align: 'left' },
],
pager:'#gridpager',
rowNum:25,
rowList:[25,50,75,100],
sortname:'Id',
sortorder:'Asc',
viewrecords:true,
imgpath:'/Content/themes/base/images',
caption:'Test Grid',
autowidth:true,
width:'100%',
height:'100%',
hoverrows:false
});
jQuery("#testgrid").jqGrid(
'navGrid','#gridpager',
{view:true,edit:false,add:false,del:false},{},{},{},
{multipleSearch:true,multipleGroup:false},{closeOnEscape:true}
);
});
</script>
<table id="testgrid"></table>
<div id="gridpager"></div>
Thanks in advance, // Linus
Not in a place to test your code but try changing your "sortorder" value 'Asc' to all lower case.
If you are implementing server side paging then add this property:
loadonce: false;
ref: http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options
Also test on your server side code if the request is coming in for the second page at all!
精彩评论