這是我第一次嘗試使用JQgrid,我從文檔中弄明白如果我需要在我的colmodel
中使用jsonmap
屬性。截至目前我得到的所有數據,但是從螢火我看到所有我得到的每一個關口是:jqgrid沒有填充Grid的數據
<td aria-describedby="list_MEMBERID" title="" style="" role="gridcell"> </td>
有人能解釋我在做什麼錯什麼呢?
的JSON:
{
"ROWS": [
{
"ID": 508,
"CELLS": {
"PHONE": "847-382-8872",
"STATE": "IL",
"ZIP": 60010,
"NAME": "Norton's U.S.A.",
"DESC": "We sell only products made in the United States!We offer an eclectic mix of common household items from toys to tools, glassware to garden supplies, fashions to food and so much more. When you shop at Norton's U.S.A, you help keep America working! ",
"CITY": "Riverwoods",
"ADDR": "400 Lageschulte Street"
}
}
],
"PAGE": 1,
"RECORDS": 1,
"TOTAL": 1
}
的JavaScript:
$(function(){
$("#list").jqGrid({
url:'cfc/buildData.cfc?method=getDining',
datatype: 'json',
mtype: 'GET',
colNames:['Member ID','Member Name', 'Address','City','Zip Code','State', 'Phone', 'Description'],
colModel :[
{name:'MEMBERID', index:'MEMBERID', jsonmap:'MEMBERID', width:60},
{name:'NAME', index:'NAME', jsonmap:'NAME', width:90},
{name:'ADDR', index:'ADDR', jsonmap:'ADDR', width:80, align:'right'},
{name:'CITY', index:'CITY', jsonmap:'CITY', width:80, align:'right'},
{name:'ZIP', index:'ZIP', jsonmap:'ZIP', width:80, align:'right'},
{name:'STATE', index:'STATE', jsonmap:'STATE', width:80, align:'right'},
{name:'PHONE', index:'PHONE', jsonmap:'PHONE', width:80, align:'right'},
{name:'DESC', index:'DESC', jsonmap:'DESC', width:200, sortable:false}
],
pager: '#pager',
rowNum: 10,
rowList:[10,20,30],
sortname: 'MEMBERID',
sortorder: 'desc',
viewrecords: true,
gridview: true,
caption: 'Lake County Members',
jsonReader : {
root: "ROWS",
page: "PAGE",
total: "TOTAL",
records: "RECORDS",
repeatitems: true,
cell: "CELLS",
id: "MEMBERID",
subgrid: {root:"ROWS",
repeatitems: true,
cell:"CELLS"
}
}
});
});