JSON(格式化后)
HTML代码举例
<html> <head> <title>jqGrid 实例</title> </head> <body> ···代码省略··· <table id="grid"></table> <div id="pager"></div> <a href="data.json">JSON FILE</a> ···代码省略··· </body> </html>
javascript代码举例
$(function(){ pageInit(); }); function pageInit(){ jQuery("#grid").jqGrid('jqPivot', "data.json", // pivot options { xDimension : [{dataName: 'CategoryName'} ], yDimension : [], aggregates : [ { member : 'Price', aggregator : 'sum', width:80, label:'Sum Price', formatter:'number', align:'right' } ] }, // grid options { width: 700, rowNum : 150, pager: "#pager", caption: "Amounts of each product category" }); }