It's actually very simple.
Novice creation, not good not to spray.
JSP page:
1 <Script>2 $(function () {3 4 $.getjson ('${pagecontext.request.contextpath}/resources/json/datagrid_data.json',function(Result) {5 varColumns=NewArray ();6 $.each (result.headers[0], function(i, field) {7 varcolumn={};8 column["title"]=i;9 column["Field"]=field;Ten column["width"]= -; One columns.push (column);//when you need to formatter the time you add it, the principle is to stitch strings. A }); - $('#tt'). DataGrid ({ - Title:'XXX company spreads replenishment distribution table', the Height: -, - Singleselect:true, - URL:"', - frozencolumns: [[ + {field:'name', Title:'Project', Width: the, sortable:true, align:'Center'}, - {field:'Count', Title:'Total', Width: Max, sortable:true} + ]],columns: [ A Columns at ], - rownumbers:true}). DataGrid ('LoadData', Result.bodys); - }); - }) - </Script> - <Divtitle= "XXX company spreads replenishment distribution table"Fit= "true"Border= "false"style= "height:94%;"> in <TableID= "tt" ></Table> - </Div>
JSON code format. I don't have to split pages, and I don't have total.
{"Headers": [ {"January": "Jan", "February": "Feb"}],"Bodys": [ {"name": "LNG", " Count ":" 50000 "," Jan ":" 20000 "," Feb ":" 30000 "}]}
This is not very simple .....
Easyui dataGrid Dynamic Add column