jqGrid を使用してテーブルを表示します。データが の場合は問題なく動作しますがlocal
、JSON で指定された場合はデータが表示されません。
私はよく検索しましたが、私の問題を説明できるスローションはありません。ここで何かアドバイスはありますか?
Javascript:
jQuery("#gpaTable").jqGrid({
url: "data.html",
datatype: "json",
pager: "#gpaPager",
height: "100%",
colNames: [
"star",
"id",
"name",
"gpa",
"tag",
"failCnt",
"lowScore",
"noScore"],
colModel: [{
name: "star",
index: "star",
width: 20
},
{
name: "id",
index: "id",
width: 80
},
{
name: "name",
index: "name",
width: 80
},
{
name: "gpa",
index: "gpa",
width: 40,
sorttype: "float"
},
{
name: "noScore",
index: "noScore",
width: 80,
sorttype: "int"
},
{
name: "lowScore",
index: "lowScore",
width: 80,
sorttype: "int"
},
{
name: "failCnt",
index: "failCnt",
width: 60,
sorttype: "int"
},
{
name: "tag",
index: "tag",
width: 300
}],
multiselect: true,
caption: "GPA",
viewrecords: true,
jsonReader: {
repeatitems: false,
id: "lineId",
cell: "cell",
root: "rows",
records: "records",
total: "pageTotal",
page: "pageId"
}
});
data.html:
{
"total": 1,
"page": 1,
"records": 1,
"pageId": 1,
"pageTotal": 1,
"rows": [{
"lineId": 1,
"cell": {
"star": "",
"id": "5090379054",
"name": "BBB",
"gpa": "2.6",
"tag": "",
"failCnt": 2,
"lowScore": 0,
"noScore": 2
}
},
{
"lineId": 2,
"cell": {
"star": "",
"id": "5090379051",
"name": "BBB",
"gpa": "2.1",
"tag": "",
"failCnt": 2,
"lowScore": 0,
"noScore": 2
}
},
{
"lineId": 3,
"cell": {
"star": "",
"id": "5090379052",
"name": "CCC",
"gpa": "3.5",
"tag": "<ul class='tagClass'><li>Tag3</li><li>Tag4</li><li>Tag5</li><li>Tag6</li></ul>",
"failCnt": 0,
"lowScore": 70,
"noScore": 0
}
},
{
"lineId": 4,
"cell": {
"star": "<span class='ui-icon ui-icon-star' value='starred' />",
"id": "5090379032",
"name": "DDD",
"gpa": "1.5",
"tag": "",
"failCnt": 1,
"lowScore": 90,
"noScore": 5
}
},
{
"lineId": 5,
"cell": {
"star": "<span class='ui-icon ui-icon-star' value='starred' />",
"id": "5090379032",
"name": "EEE",
"gpa": "1.2",
"tag": "<ul class='tagClass'><li>Tag3</li></ul>",
"failCnt": 4,
"lowScore": 120,
"noScore": 2
}
}]
}