<script type="text/javascript">
function addTab(href){
var id = parseInt(href.substr(31,6));
var task = href.substr(26,11);
parent.Ext.getCmp("myTabPanel").add({
id:id,
title: task,
closable: true,
iconCls: 'Feed',
html: '<iframe src="'+href+'" scrolling="auto" frameborder="0" width="100%" height="100%"></iframe>'
});
parent.Ext.getCmp("myTabPanel").setActiveTab(id);
}
</script>
以上是在其他頁面獲取tabpanel
配置id,判斷存在就激活,否則在添加
function addTab(href) {
var id = parseInt(href.substr(31, 6));
if (Ext.getCmp(id)) { tab.setActiveTab(id); return}/////////
var task = href.substr(26, 11);
parent.Ext.getCmp("myTabPanel").add({
id: id,
title: task,
closable: true,
iconCls: 'Feed',
html: '<iframe src="' + href + '" scrolling="auto" frameborder="0" width="100%" height="100%"></iframe>'
});
parent.Ext.getCmp("myTabPanel").setActiveTab(id);
}