树形菜单
在firefox没有出错,菜单会显示,在IE上只显示只显示一个根节点 只执行到1 ,2 执行不到
Ext.namespace("sys");
sys.WestPanel = Ext.extend(Ext.Panel, {
constructor : function(cfg) {
if(!cfg)
cfg = {};
Ext.applyIf(cfg, {
layout:'accordion',
title : '我的地盘我作主',
border : false,// 无边框样式
width : 180,// 必须指定
collapsible : true,// 收缩
split : true,// 拖动
collapseMode : 'mini',// 前提要能拖动
id:'westPanel'
});
var self = this;
Ext.Ajax.request({
url: 'menu/menuAction!show.do',
method:'post',
success:function(response, opts){
var data = Ext.decode(response.responseText);
alert(Ext.encode(data));
for(var i=0; i<data.length; i++){
//alert(Ext.encode(data[i]));
var m = data[i];
var p = new Ext.tree.TreePanel({
title:m.text,
border:false,
bodyBorder:false,
root:m,
region:'west',
iconCls:'firstMenu',
rootVisible:false,
listeners:{
'click':function(node){
}
}
});
self.add(p);
}
alert("1");
self.doLayout();//这里不能执行
alert("2");
},
failure:function(){
Ext.MessageBox.alert("错误", "操作失败");
}
});
sys.WestPanel.superclass.constructor.call(this, cfg);
}
});
menu/menuAction!show.do和alert(Ext.encode(data));打印出来的数据一样,数据如下
[{"children":[{"children":[],"icon":"images\/icon\/node.gif","id":21,"leaf":true,"panelClass":null,"text":"角色信息管理","url":null},{"children":[],"icon":"images\/icon\/node.gif","id":22,"leaf":true,"panelClass":null,"text":"职员信息管理","url":null},{"children":[],"icon":"images\/icon\/node.gif","id":23,"leaf":true,"panelClass":"sys.dept.DeptPanel","text":"部门管理","url":null},{"children":[],"icon":"images\/icon\/node.gif","id":24,"leaf":true,"panelClass":null,"text":"登录日志管理","url":null}],"icon":"images\/icon\/node.gif","id":2,"leaf":false,"panelClass":null,"text":"系统管理","url":null},{"children":[{"children":[],"icon":"images\/icon\/node.gif","id":31,"leaf":true,"panelClass":null,"text":"客户信息管理","url":null},{"children":[],"icon":"images\/icon\/node.gif","id":32,"leaf":true,"panelClass":null,"text":"外部订单管理","url":null}],"icon":"images\/icon\/node.gif","id":3,"leaf":false,"panelClass":null,"text":"市场部","url":null},{"children":[{"children":[],"icon":"images\/icon\/node.gif","id":41,"leaf":true,"panelClass":null,"text":"内部订单管理","url":null},{"children":[],"icon":"images\/icon\/node.gif","id":42,"leaf":true,"panelClass":null,"text":"产品库存管理","url":null},{"children":[],"icon":"images\/icon\/node.gif","id":43,"leaf":true,"panelClass":null,"text":"材料库存管理","url":null},{"children":[],"icon":"images\/icon\/node.gif","id":44,"leaf":true,"panelClass":null,"text":"产品出库管理","url":null},{"children":[],