当前位置: 代码迷 >> Web前端 >> tabPanel 的一种形式
  详细解决方案

tabPanel 的一种形式

热度:688   发布时间:2012-11-07 09:56:10.0
tabPanel 的一种模式

试了好多次终于好到一个个人认为比较好的tabPanel处理方法
function createTabpanel(account){
??? ??? var panel = tabpanel.getComponent(account.account_id);
??? ??? if(panel){
??? ??? ??? //tabpanel.hideTabStripItem(panel);//
??? ??? ??? tabpanel.unhideTabStripItem(panel);
??? ??? ??? tabpanel.setActiveTab(panel);
??? ??? }else{
??? ??? ??? panel = new Ext.Panel({
??? ??? ??? ??? id:account.account_id,
??? ??? ??? ??? html:account.account_id,
??? ??? ??? ??? title:'帐户:' + account.account_id + '帐户关系',
??? ??? ??? ??? closable:true
??? ??? ??? ????
??? ??? ??? });
??? ??? ????
??? ??? ????
??? ??? ????
??? ??? ??? tabpanel.add(panel);
??? ??? ??? tabpanel.setActiveTab(panel);
??? ??? ??? panel.on('beforeclose',function(p){
??? ??? ??? ??? tabpanel.hideTabStripItem(p);
??? ??? ??? ??? tabpanel.syncSize();
??? ??? ??? ??? return false;
??? ??? ??? })
??? ??? }
??? }

页面可以缓存起来,提高效率,同时没有销毁 不会报错,

1 楼 micki 2010-04-14  
是挺好的,Tabpanel的内存泄漏一直都是比较严重的,直接不要销毁比较好
2 楼 czpae86 2010-04-14  
有没有试过单页面autoLoad?不过看你是什么开发模式。
nodeOnClick : function(node){
if(node.hasChildNodes()) return;
var o = Ext.getCmp(node.id);
if(!o){
o = this.tabPanel.add({
id : node.id,
title : node.text,
closable : true,
autoLoad : {url:node.attributes.url,scripts:true,scope:this}
});
}
this.tabPanel.setActiveTab(o);
this.tabPanel.doLayout();
}
3 楼 chemzqm 2010-04-15  
个人还是喜欢autoLoad 不知道楼主tab里面放的什么?iframe?