【发布时间】:2011-02-16 11:13:20
【问题描述】:
我遇到了jqGrid 和 JSON 数据的问题。基本上网格不会显示任何数据,而是将 [object Object] 输出到表格的第一列。下面是我正在使用的数据的 sn-p。它是有效的 JSON。
{
"currpage": "1",
"totalpages": "3",
"totalrecords": "70",
"rows": [
{
"id": "uid\u003dAndrewBryant",
"cells": [
{
"HOURS_ENTITLED": "203",
"HOURS_TAKEN": 0,
"NAME": "uid\u003dAndrewBryant",
"SICKNESS_TAKEN": 0,
"TAKEN_TOIL": 0,
"TOTAL_TOIL": 0,
"YEAR_ENTILEMENT": "2011"
}
]
},
下面是我用来调用 jqGrid 功能的代码:
$(document).ready(function() {
$("#statsTable").jqGrid({
url: "http://cw-epuip-d01.tm-gnet.com:10040/wps/PA_Resource_Manager_1/JSONServlet",
datatype: "json",
mtype: "get",
jsonReader : {
root: "rows",
cell:"cells",
page: "currpage",
total: "totalpages",
records: "totalrecords",
id: "id"
},
colNames: ['NAME', 'HOURS ENTITLED', 'HOURS TAKEN' ],
colModel: [
{name:'NAME', index:'NAME'},
{name:'HOURS_ENTITLED', index:'HOURS_ENTITLED'},
{name:'HOURS_TAKEN', index:'HOURS_TAKEN'}
]
}
);
});
我错过了什么?
【问题讨论】:
标签: jquery jquery-plugins jqgrid