日期:2014-05-16 浏览次数:20413 次
$(function() { var lastIndex=0; $('#listTable').treegrid({ title:'菜单编辑', width:500, height:300, rownumbers: true, collapsible:true, url:'${path}/sys/listChildrenMenusDetailAjax', idField:'menuId', treeField:'menuId', pagination : true, pageSize : 10, onLoadSuccess:function(data){ alert(data); }, columns:[[ {field:'menuId',title:'菜单ID',width:160}, {field:'menuName',title:'菜单名称',width:80,align:'right'}, {field:'menuUrl',title:'菜单URL',width:100} ]] }); });
@Action(value = "listChildrenMenusDetailAjax") public void listChildrenMenusDetailAjax() { setChannel(ACTION_TYPE.ADMIN); PrintWriter out; try { response.setContentType("text/html;charset=GBK"); response.setCharacterEncoding("GBK"); out = response.getWriter(); MenuExample menuExample = new MenuExample(); System.out.println(); //menuExample.setRowStartNum((page - 1) * rows); //menuExample.setRowEndNum((page) * rows); menuExample.setOrderByClause("MENU_ID"); List<Menu> allMenus= menuService.findMenuByExample(menuExample); System.out.println(allMenus); Map<String, Object> outJson = new HashMap<String, Object>(); total =menuService.countByExample(new MenuExample()); outJson.put("total", total); outJson.put("rows", allMenus); JSONObject jSONObject = JSONObject.fromObject(outJson); logger.debug(jSONObject.toString()); out.write(jSONObject.toString()); } catch (IOException e) { logger.warn("查询菜单字列表错误!",e); } }
logger.debug(jSONObject.toString());
[{ "id":1, "text":"Folder1", "iconCls":"icon-ok" },{ "text":"Languages", "state":"closed", "children":[{ "id":"j1", "text":"Java" },{ "id":"j2", "text":"C#" }] }]