easy ui tree
action JSON的值是这样的: [color=red]{"systemMenuTreeList[/color]":[{"attributes":null,"children":[],"iconCls":null,"id":"282","state":"open","text":"test"},{"attributes":null,"children":[{"attributes":null,"children":[{"attributes":null,"children":[{"attributes":{"menuUrl":"dd"},"children":[],"iconCls":"ico-sub_menu","id":"1","state":"open","text":"系统管理"},{"attributes":{"menuUrl":"ee"},"children":[],"iconCls":"ico-sub_menu","id":"2","state":"open","text":"模组管理"},{"attributes":{"menuUrl":"ff"},"children":[],"iconCls":"ico-sub_menu","id":"3","state":"open","text":"父菜单管理"},{"attributes":{"menuUrl":null},"children":[],"iconCls":"ico-sub_menu","id":"4","state":"open","text":"子菜单管理"},{"attributes":{"menuUrl":null},"children":[],"iconCls":"ico-sub_menu","id":"5","state":"open","text":"用户管理"},{"attributes":{"menuUrl":null},"children":[],"iconCls":"ico-sub_menu","id":"6","state":"open","text":"用户权限管理"}],"iconCls":"icon-save","id":"1","state":"open","text":"系统管理"}],"iconCls":"icon-save","id":"1","state":"open","text":"系统管理"}],"iconCls":"ico-systems","id":"1","state":"open","text":"系统管理"},{"attributes":null,"children":[{"attributes":null,"children":[{"attributes":null,"children":[{"attributes":{"menuUrl":"www.baidu.com"},"children":[],"iconCls":"ico-sub_menu","id":"7","state":"open","text":"测试1"},{"attributes":{"menuUrl":"www.126.com"},"children":[],"iconCls":"ico-sub_menu","id":"8","state":"open","text":"测试2"},{"attributes":{"menuUrl":"cc"},"children":[],"iconCls":"ico-sub_menu","id":"9","state":"open","text":"测试3"}],"iconCls":"icon-save","id":"2","state":"open","text":"测试程序"}],"iconCls":"icon-save","id":"2","state":"open","text":"测试"}],"iconCls":"ico-systems","id":"2","state":"open","text":"测试"}]} 然后easy ui需要的JSON数据格式是: [{ "id":1, "text":"Folder1", "iconCls":"icon-save", "children":[{ "text":"File1", "checked":true },{ "text":"Books", "state":"open", "attributes":{ "url":"/demo/book/abc", "price":100 }, "children":[{ "text":"PhotoShop", "checked":true },{ "id": 8, "text":"Sub Bookds", "state":"closed" }] }] },{ "text":"Languages", "state":"closed", "children":[{ "text":"Java" },{ "text":"C#" }] }] /* * 获取系统菜单树JSON */ function getSystemMenuTree(){ //获取系统菜单树JSON数据 $('#menuTree').tree({ url: "../admin/systemMenuTreeJsonAction!getSystemMenuTreeJson", loadFilter: function(data){ //alert(data.systemMenuTreeList); return data.systemMenuTreeList[color=red];//这里必须经过处理,不能直接返回data[/color] //return data; } , formatter:function(node){ //return ""+ node.text + ""; return node.text; }, onClick: function(node){ //alert($('#menuTree').tree('isLeaf',node.target)); //alert(node.attributes.menuUrl); if($('#menuTree').tree('isLeaf',node.target)){ alert(node.attributes.menuUrl); //window.location.href=node.attributes.menuUrl; window.navigate(node.attributes.menuUrl); alert(node.text); // alert node text property when clicked } } }); }