0
有人可以幫我。我正在嘗試使用JQGrid動態呈現使用json的列和數據。列似乎正在出現,但沒有行數據。JQGrid顯示列但沒有行數據
下面是我從我的服務返回JSON:
{
"total": 1,
"page": 1,
"records": 1,
"rows": [
{
"id": 29291,
"cell": [
"Jim",
"1",
"2"
]
}
],
"columns": [
"Name",
"30/10/2012",
"23/10/2012"
],
"columnmodel": [
{
"name": "Name",
"index": "Name",
"align": "left",
"width": 25
},
{
"name": "30/10/2012",
"index": "30/10/2012",
"align": "left",
"width": 25
},
{
"name": "23/10/2012",
"index": "23/10/2012",
"align": "left",
"width": 25
}
]
}
而且我現在用的就是JavaScript的:
$.ajax({
type: "GET",
url: "ListData?ID=1",
datatype: "json",
success: function(result){
$("#customgrid").jqGrid({
datatype: "json",
colNames: result.columns,
colModel: result.columnmodel,
data: result.rows,
width: 800,
pager: "#customgridpager",
viewrecords: true,
sortable: true,
gridview: true,
});
},
});
任何幫助將不勝感激。
傳奇!非常感謝。週末愉快。 –