当前位置: 代码迷 >> J2EE >> struts2 Ext3 jsvm jsonplugin 树形菜单,该如何解决
  详细解决方案

struts2 Ext3 jsvm jsonplugin 树形菜单,该如何解决

热度:470   发布时间:2016-04-22 01:16:51.0
struts2 Ext3 jsvm jsonplugin 树形菜单
在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":[],"icon":"images\/icon\/node.gif","id":45,"leaf":true,"panelClass":null,"text":"产品入库管理","url":null},{"children":[],"icon":"images\/icon\/node.gif","id":46,"leaf":true,"panelClass":null,"text":"材料入库管理","url":null},{"children":[],"icon":"images\/icon\/node.gif","id":47,"leaf":true,"panelClass":null,"text":"材料出库管理","url":null}],"icon":"images\/icon\/node.gif","id":4,"leaf":false,"panelClass":null,"text":"仓储部","url":null},{"children":[{"children":[],"icon":"images\/icon\/node.gif","id":51,"leaf":true,"panelClass":null,"text":"产品管理","url":null},{"children":[],"icon":"images\/icon\/node.gif","id":52,"leaf":true,"panelClass":null,"text":"材料管理","url":null},{"children":[],"icon":"images\/icon\/node.gif","id":53,"leaf":true,"panelClass":null,"text":"产品类型管理","url":null},{"children":[],"icon":"images\/icon\/node.gif","id":54,"leaf":true,"panelClass":null,"text":"材料类型管理","url":null},{"children":[],"icon":"images\/icon\/node.gif","id":55,"leaf":true,"panelClass":null,"text":"生产单管理","url":null}],"icon":"images\/icon\/node.gif","id":5,"leaf":false,"panelClass":null,"text":"生产部","url":null},{"children":[{"children":[],"icon":"images\/icon\/node.gif","id":61,"leaf":true,"panelClass":null,"text":"供应商管理","url":null},{"children":[],"icon":"images\/icon\/node.gif","id":62,"leaf":true,"panelClass":null,"text":"采购单管理","url":null},{"children":[],"icon":"images\/icon\/node.gif","id":63,"leaf":true,"panelClass":null,"text":"订购单管理","url":null}],"icon":"images\/icon\/node.gif","id":6,"leaf":false,"panelClass":null,"text":"采购部","url":null}]
  相关解决方案