详见 [url]http://www.iteye.com/problems/18649[/url]。
并见附件图片,
代码请下载,但请坐修改,这里连接了数据库,所以请修改Node节点。
另外,点击一个节点后,在tabpanel里加了一个新tab,但是点击另外一个节点,再点击回来后,那个tabpanel里的formpanel就不见了。Tell me Why?!!
详见 [url]http://www.iteye.com/problems/18649[/url]。
并见附件图片,
代码请下载,但请坐修改,这里连接了数据库,所以请修改Node节点。
另外,点击一个节点后,在tabpanel里加了一个新tab,但是点击另外一个节点,再点击回来后,那个tabpanel里的formpanel就不见了。Tell me Why?!!
[code="js"]MainPanel = Ext.extend(Ext.TabPanel, {
constructor : function() {
MainPanel.superclass.constructor.call(this, {
id : 'MainPanel',
region : 'center',
activeTab : 0,
items : [{
title : 'Default Tab',
html : "
});
},
AddComponent : function(node, event) {
n = this.add({
id : node.id.toString(),
title : node.text,
closable : true,
autoLoad : {
url : "/ModuleManger.jsp",
scripts : true,
scope : this,
callback : function(response, success) {
},
text : "Loading Page of" + node.text + "........."
}
});
n.doLayout();
this.setActiveTab(n);
}
});
NorthPanel = Ext.extend(Ext.Panel, {
constructor : function() {
NorthPanel.superclass.constructor.call(this, {
region : "north",
height : 50,
title : "显示登录用户"
})
}
});
SouthPanel = Ext.extend(Ext.Panel, {
constructor : function() {
SouthPanel.superclass.constructor.call(this, {
region : "south",
height : 50,
title : "技术支持,版权申明"
})
}
});
WestPanel = Ext.extend(Ext.Panel, {
constructor : function() {
WestPanel.superclass.constructor.call(this, {
})
}
});
EastPanel = Ext.extend(Ext.Panel, {
constructor : function() {
EastPanel.superclass.constructor.call(this, {
region : "east",
width : 100,
title : "右边面板"
})
}
});
Ext.onReady(function() {
var mainPanel = new MainPanel({});
var northPanel = new NorthPanel({});
var southPanel = new SouthPanel({});
var westPanel = new WestPanel({});
var view = new Ext.Viewport({
layout : "border",
items : [northPanel, mainPanel, southPanel, {
region : "west",
width : 260,
split : true,
collapsible : true,
fitToFrame : true,
closable : true,
title : "左边面板",
layout : 'accordion',// 下拉功能属性
layoutConfig : {
titleCollapse : false,
animate : true,
activeOnTop : true
},
items : [{
title : '我的系统',
layout : 'fit',
items : [
new Ext.tree.TreePanel({
root : new Ext.tree.AsyncTreeNode({
text : '我的系统目录s',
draggable : false,
expanded : true,
id : 'root',
href : '#',
loader : new Ext.tree.TreeLoader({
url : 'treeData.json',
listeners : {
'beforeload' : function(treeLoader, node) {
treeLoader.baseParams.id = node.id
}
}
})
}),
width : 250,
frame : true,
layout : 'fit',
border : false,
animate : true,
useArrows : true,
autoHeight : true,
autoScroll : true,
border : false,
listeners : {
'click' : function(node, event) {
if (node.isLeaf()) {
event.stopEvent();
// if (node.attributes.url != "" && node.attributes.url !=
// undefined) {
mainPanel.AddComponent(node, event);
// } else {
// Ext.Msg.alert("Warm Notice!", "This Page Will Coming Soon!");
// }
}
},
scope : this
}
})
]
}, {
title : '系统设置',
html : '<div id="tree-setting" style="overflow:auto;width:100%;height:100%"></div>'
}]
}]
});
})[/code]
哥们,调试你的代码那个真叫累呀
给你一些建议吧
尽量不要使用id
不要什么都继承
js和html最好分开
不要总想着用renderTo去渲染
对象之间的依赖别太强了