我的 jqgrid 表有问题:我加载了 json,我有我的表,但我只能看到表的最后一页,无法更改页面。
js代码:
$("#list").jqGrid(
{
url:'test.json',
datatype: "json",
mtype: 'GET',
colNames:['id','model','cc','nation','prod'],
colModel:[
{name:'id', index:'id', jsonmap:"id", width:25},
{name:'model', index:'model', jsonmap:"model", width:50},
{name:'cc', index:'cc', jsonmap:"cc", width:25},
{name:'nation', index:'nation', jsonmap:"nation", width:50},
{name:'prod', index:'prod', jsonmap:"prod", width:50}
],
rowNum: "2",
page: "1",
rowList: [2,4,6],
autowidth: true,
pager: '#pager',
height: "100%",
sortname: 'id',
caption: "Elenco delle Moto",
jsonReader: {root: 'rows',page: 'page',total: 'total',records: 'records',repeatitems: false,id: 'id'},
loadComplete: function() {
grid.setGridHeight('auto');
}
});
$("#list").jqGrid('navGrid','#pager',{edit:false,add:false,del:false,search:false});
$("#visual").hide();
和我的 json 文件:
{
"total": "3",
"page": "1",
"records": "5",
"rows":
[
{
"Id": "1",
"model": "shiver",
"cc": "750",
"nation": "italy",
"prod": "aprilia"
},
{
"Id": "2",
"model": "monster",
"cc": "696",
"nation": "italy",
"prod": "ducati"
}
],
"page":"2",
"rows":
[
{
"Id": "3",
"model": "z750",
"cc": "750",
"nation": "japan",
"prod": "kawasaki"
},
{
"Id": "4",
"model": "hornet",
"cc": "700",
"nation": "japan",
"prod": "honda"
}
],
"page":"3",
"rows":
[
{
"Id": "5",
"model": "speedtriple",
"cc": "1000",
"nation": "england",
"prod": "buell"
}
]
}
我试过很多次,但总是一样的结果..有人可以帮助我吗?