代码如下
其中grid是我在前边代码定义好的
var menuTree = new Ext.tree.TreePanel({
region:'west',
title:'功能菜单',
width:180,
// minSize:150,
// maxSize:200,
// split:true,
// autoScroll:true,
// autoHeight:false,
collapsible:true,
// rootVisable:false, //不显示根节点
dataUrl: 'system/samlib/get-nodes.php',
root: {
nodeType: 'async',
text: 'Ext JS',
draggable:false,
id:'source'
},
listeners: {
'render': function(tp){
tp.getSelectionModel().on('selectionchange', function(tree, node){
if(node.isLeaf()){
alert(node.attributes+"|"+node.leaf+"|"+node.text+"|"+node.id);
/* var tabWin = app.getModule('Spidermodel');
if(tabWin){
tabWin.launcher.handler.call(this.scope || this);
}
*/
var n = contentPanelc
'id':node.id,
'title':node.text,
closable:true, //通过html载入目标页
items: grid
// html:'<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="system/samlib/get-nodes.php?s=m"></iframe>'
});
contentPanel.setActiveTab(n);
} })
}
}
});
其中grid是我在前边代码定义好的
var menuTree = new Ext.tree.TreePanel({
region:'west',
title:'功能菜单',
width:180,
// minSize:150,
// maxSize:200,
// split:true,
// autoScroll:true,
// autoHeight:false,
collapsible:true,
// rootVisable:false, //不显示根节点
dataUrl: 'system/samlib/get-nodes.php',
root: {
nodeType: 'async',
text: 'Ext JS',
draggable:false,
id:'source'
},
listeners: {
'render': function(tp){
tp.getSelectionModel().on('selectionchange', function(tree, node){
if(node.isLeaf()){
alert(node.attributes+"|"+node.leaf+"|"+node.text+"|"+node.id);
/* var tabWin = app.getModule('Spidermodel');
if(tabWin){
tabWin.launcher.handler.call(this.scope || this);
}
*/
var n = contentPanelc
'id':node.id,
'title':node.text,
closable:true, //通过html载入目标页
items: grid
// html:'<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="system/samlib/get-nodes.php?s=m"></iframe>'
});
contentPanel.setActiveTab(n);
} })
}
}
});
下面是 contentPanel.setActiveTab(n);
要调用tab的add(grid)方法