datagrid_test.js
- $(function(){
- $('#dg').datagrid({
- url:"http://localhost:8080/test/getTable.do",
- width:400,
- columns:[[
- {field:'date',title:'日期',rowspan:2,width:150,align:'center'},
- {title:'注册量',halign:'center',colspan:3,width:250},
- ],[
- {field:'weixin',title:'微信',width:80,sortable:true,align:'center'},
- {field:'application',title:'APP',width:80,sortable:true,align:'center'},
- {field:'web',title:'网站',width:100,align:'center',sortable:true}
- ]]
- });
- });
controller
- @RequestMapping("/getTable.do")
- @ResponseBody
- public List<Map<String, Object>> getTable()
- {
- Map<String, Object> rstMap = new HashMap<String, Object>();
-
- for (int i=0;i<1;i++) {
- Map<String, Object> v1 = new HashMap<String, Object>();
- v1.put("date", new Date().getTime());
- v1.put("weixin", 123);
- v1.put("application", 123);
- v1.put("web", 123);
-
- rowList.add(v1);
- }
-
- return rowList;
- }
传递的数据格式
[{"application":123,"weixin":123,"web":123,"date":1444878359901}]