php显示表格内容为空,具有JSON数据的php – jqGrid将表格呈现为空

我试图创建一个jqgrid,但表是空的.该表呈现,但数据不显示.

从php调用回来的数据是:

{

"page":"1",

"total":1,

"records":"10",

"rows":[

{"id":"2:1","cell":["1","image","Chief Scout","Highest Award test","0"]},

{"id":"2:2","cell":["2","image","Link Badge","When you are invested as a Scout, you may be eligible to receive a Link Badge. (See page 45)","0"]},

{"id":"2:3","cell":["3","image","Pioneer Scout","Upon completion of requirements, the youth is invested as a Pioneer Scout","0"]},

{"id":"2:4","cell":["4","image","Voyageur Scout Award","Voyageur Scout Award is the right after Pioneer Scout.","0"]},

{"id":"2:5","cell":["5","image","Voyageur Citizenship","Learning about and caring for your community.","0"]},

{"id":"2:6","cell":["6","image","Fish and Wildlife","Demonstrate your knowledge and involvement in fish and wildlife management.","0"]},

{"id":"2:7","cell":["7","image","Photography","To recognize photography knowledge and skills","0"]},

{"id":"2:8","cell":["8","image","Recycling","Demonstrate your knowledge and involvement in Recycling","0"]},

{"id":"2:10","cell":["10","image","Voyageur Leadership ","Show leadership ability","0"]},

{"id":"2:11","cell":["11","image","World Conservation","World Conservation Badge","0"]}

]}

javascript配置如下所示:

$("#"+tableId).jqGrid ({

url:'getAwards.php?id='+classId,

dataType : 'json',

mtype:'POST',

colNames:['Id','Badge','Name','Description',''],

colModel : [

{name:'awardId', width:30, sortable:true, align:'center'},

{name:'badge', width:40, sortable:false, align:'center'},

{name:'name', width:180, sortable:true, align:'left'},

{name:'description', width:380, sortable:true, align:'left'},

{name:'selected', width:0, sortable:false, align:'center'}

],

sortname: "awardId",

sortorder: "asc",

pager: $('#'+tableId+'_pager'),

rowNum:15,

rowList:[15,30,50],

caption: 'Awards',

viewrecords:true,

imgpath: 'scripts/jqGrid/themes/green/images',

jsonReader : {

root: "rows",

page: "page",

total: "total",

records: "records",

repeatitems: true,

cell: "cell",

id: "id",

userdata: "userdata",

subgrid: {root:"rows", repeatitems: true, cell:"cell" }

},

width: 700,

height: 200

});

HTML看起来像:

我不知道我需要定义jsonReader,因为我试图保持默认.如果PHP代码有帮助,我也可以发布.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值