原因是我们没有加上 jsonReader : {
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: false,
cell: "cell",
id: "id"
}
如下所示:
jQuery(document).ready(function(){
jQuery("#list").jqGrid({
url:'tableQuery_line_list.action',
datatype: 'json',
mtype: 'POST',
colNames:['ID','出发城市','到达城市'],
colModel :[
{name:'id', index:'id', width:155},
{name:'from_name', index:'from_name', width:190},
{name:'to_name', index:'to_name', width:190}
],
pager: '#pager',
rowNum:30,
rowList:[10,20,30],
sortname: 'id',
sortorder: 'desc',
height:660,
viewrecords: true,
caption: '线路列表',
jsonReader : {
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: false,
cell: "cell",
id: "id"
}
});
});