jsonReader: {
root:"data",
page: "page",
total: "total",
records: "record",
repeatitems : false
},
1.json 是一个比较好web 传送数据格式,jqgrid里面jsonreader 怎样解析json 数据
jQuery("#gridid").jqGrid({
... jsonReader :
{
root: "rows", //数据模型
page: "page",//数据页码
total: "total",//数据总页码
records: "records",//数据总记录数
repeatitems: true,//如果设为false,则jqGrid在解析json时,会根据name(colmodel 指定的name)来搜索对应的数据元素(即可以json中元素可以不按顺序)
cell: "cell",//root 中row 行
id: "id",//唯一标识
userdata: "userdata",
subgrid: {
root:"rows", repeatitems: true, cell:"cell"
}
},
... });
示例json 数据格式;
{
"total": "xxx", "page": "yyy", "records": "zzz",
"rows" : [
{"id" :"1", "cell" :["cell11", "cell12", "cell13"]},
{"id" :"2", "cell":["cell21", "cell22", "cell23"]},
... ]
}
示例2;可以设置自己json 标识
jQuery("#gridid").jqGrid({
... jsonReader :
{
root