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 "<a href='#'>"+ node.text + "</a>";
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
}
}
});
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值