X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775:/src/widgets/TabPanel.js diff --git a/src/widgets/TabPanel.js b/src/widgets/TabPanel.js index ccd3fdcb..bcef3eac 100644 --- a/src/widgets/TabPanel.js +++ b/src/widgets/TabPanel.js @@ -1,5 +1,5 @@ /*! - * Ext JS Library 3.0.0 + * Ext JS Library 3.0.3 * Copyright(c) 2006-2009 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license @@ -425,11 +425,11 @@ new Ext.TabPanel({ // private initEvents : function(){ Ext.TabPanel.superclass.initEvents.call(this); - this.on('add', this.onAdd, this, {target: this}); - this.on('remove', this.onRemove, this, {target: this}); - - this.mon(this.strip, 'mousedown', this.onStripMouseDown, this); - this.mon(this.strip, 'contextmenu', this.onStripContextMenu, this); + this.mon(this.strip, { + scope: this, + mousedown: this.onStripMouseDown, + contextmenu: this.onStripContextMenu + }); if(this.enableTabScroll){ this.mon(this.strip, 'mousewheel', this.onWheel, this); } @@ -466,6 +466,7 @@ new Ext.TabPanel({ if(t.close){ if (t.item.fireEvent('beforeclose', t.item) !== false) { t.item.fireEvent('close', t.item); + delete t.item.tabEl; this.remove(t.item); } return; @@ -563,12 +564,16 @@ new Ext.TabPanel({ }, // private - onAdd : function(tp, item, index){ - this.initTab(item, index); - if(this.items.getCount() == 1){ - this.syncSize(); + onAdd : function(c){ + Ext.TabPanel.superclass.onAdd.call(this, c); + if(this.rendered){ + var items = this.items; + this.initTab(c, items.indexOf(c)); + if(items.getCount() == 1){ + this.syncSize(); + } + this.delegateUpdates(); } - this.delegateUpdates(); }, // private @@ -585,15 +590,16 @@ new Ext.TabPanel({ }, // private - onRemove : function(tp, item){ - Ext.destroy(Ext.get(this.getTabEl(item))); - this.stack.remove(item); - item.un('disable', this.onItemDisabled, this); - item.un('enable', this.onItemEnabled, this); - item.un('titlechange', this.onItemTitleChanged, this); - item.un('iconchange', this.onItemIconChanged, this); - item.un('beforeshow', this.onBeforeShowItem, this); - if(item == this.activeTab){ + onRemove : function(c){ + Ext.TabPanel.superclass.onRemove.call(this, c); + Ext.destroy(Ext.get(this.getTabEl(c))); + this.stack.remove(c); + c.un('disable', this.onItemDisabled, this); + c.un('enable', this.onItemEnabled, this); + c.un('titlechange', this.onItemTitleChanged, this); + c.un('iconchange', this.onItemIconChanged, this); + c.un('beforeshow', this.onBeforeShowItem, this); + if(c == this.activeTab){ var next = this.stack.next(); if(next){ this.setActiveTab(next); @@ -643,7 +649,9 @@ new Ext.TabPanel({ onItemIconChanged : function(item, iconCls, oldCls){ var el = this.getTabEl(item); if(el){ - Ext.fly(el).child('span.x-tab-strip-text').replaceClass(oldCls, iconCls); + el = Ext.get(el); + el.child('span.x-tab-strip-text').replaceClass(oldCls, iconCls); + el[Ext.isEmpty(iconCls) ? 'removeClass' : 'addClass']('x-tab-with-icon'); } }, @@ -1030,7 +1038,7 @@ new Ext.TabPanel({ * @hide */ /** - * @property title + * @cfg title * @hide */ /** @@ -1097,4 +1105,4 @@ Ext.TabPanel.AccessStack = function(){ return items.pop(); } }; -}; \ No newline at end of file +};