这里追加了类似的问题,但我无法找到答案,我的一个:jQuery的,jqGrid的分页:不能切换
在HTML中是 表ID =电网和DIV ID =分页:
我也有我js代码:
var myGrid = $("#grid").jqGrid({
url: _options.gridFetch,
datatype: "json",
colModel:[
{name:'id',index:'id', width:55},
{name:'name',index:'name', width:555, editable:true},
{name:'is_promoted',index:'is_promoted', width:165, editable:true, formatter: $.adminCategoryEntries._boolFormatter, edittype: 'select', editoptions:{value:"1:Yes;0:No"}},
{name:'is_in_shop',index:'is_in_shop', width:165, editable:true, formatter: $.adminCategoryEntries._boolFormatter, edittype: 'select', editoptions:{value:"1:Yes;0:No"}},
{name:'actions', formatter:'actions', width: 85, formatoptions:{keys:true}},
],
pager: '#pager',
jsonReader : { repeatitems: false } ,
rowNum: 10,
rowList: [10, 20, 500],
viewrecords: true,
autowidth: true,
sortname: 'id',
sortorder: 'desc'
});
myGrid.jqGrid('navGrid','#pager',{edit:false,add:false,del:false,search:false});
我已经使用其他stackoverflow教程中的代码。
这里是我的问题:如果我尝试更改我的导航器中显示的行数,我可以看到所有存储的数据(86行),但是如果我将行设置为10(小于行数)总是看到在我的导航:
页1的5
,我不能切换到另一个它总是停留在第一
JSON信息:
>page: 1
>records: "86"
>rows: [{id:3, name:Ulkofilee/Naudanliha, is_promoted:1, is_in_shop:1},…]
>total: 5
在此先感谢 拉狄克
我想这个问题的根源是服务器响应中的错误JSON数据。如果在寻呼机中出现错误的“第1页,共5页”信息,您能否包含从服务器收到的JSON数据?要捕获HTTP流量,您可以使用[Fiddler](http://www.fiddler2.com/fiddler2/),[Firebug](http://getfirebug.com/)或Internet Explorer的开发工具的“网络”选项卡(按F12)或Google Chrome。 – Oleg 2012-03-04 11:11:03
如果您返回总数:5,那么我编辑edmy问题 – radek 2012-03-04 11:14:49
,然后jqGrid显示“第1页,共5页”。您应该只计算输入的'rows'参数的'total'值,它代表每页的行数。例如,如果行等于28,则应将3作为“总计”值。 – Oleg 2012-03-04 11:23:00