-
21 Oct 2009 11:37 AM #1
[FIXED-331][3.0.3] Can't show new tab after last tab in tab panel is closed
[FIXED-331][3.0.3] Can't show new tab after last tab in tab panel is closed
Ext version tested:
- Ext 3.0.3
Adapter used:- yui, but I'd guess that this affects all adpaters
Browser versions tested against:- Firefox 3.5.3
Operating System:- Mac OS X 10.6, but this doesn't seem to be OS-specific
Description:
When you have a tab panel, then remove all the tabs, and then add a new panel and show it, it fails with "this.getComponent(item) is undefined" at ext-all-debug.js line 41151. The tab can't be activated -- clicking it doesn't show it and display its contents.
Below is the whole page that fails. Works fine with ext-3.0.0 and everything else the same. Which leads me to a question -- is there a regression test suite that is run for these patch releases? What is the general policy on patch releases? Are they supposed to be thoroughly tested, or are they more like beta releases?
Test Case:
Code:<html> <head> <meta http-equiv="content-type" content="text/html;charset=UTF-8"> <script type="text/javascript" src="/jslib/yui/utilities/utilities.js"></script> <script type="text/javascript" src="/jslib/ext/adapter/yui/ext-yui-adapter.js"></script> <script type="text/javascript" src="/jslib/ext/ext-all-debug.js"></script> <link rel="stylesheet" type="text/css" href="/jslib/ext/resources/css/ext-all.css" /> <script type="text/javascript"> var viewport, cp; Ext.onReady(function() { viewport = new Ext.Viewport({ layout: 'border', items: [ { xtype: 'box', region: 'north', el: 'header', height: 20 }, { region:'west', id: 'nav-panel', collapsible: true, split: true, width: 150, minSize: 100, maxSize: 400 }, { xtype: 'tabpanel', region: 'center', itemId: 'center-panel', enableTabScroll: true, defaults: {autoScroll: true}, layoutOnTabChange: true, items: [{ xtype: 'panel', title: 'Testing', html: 'this is a test', closable: true }] }, { xtype: 'box', region: 'south', el: 'footer', height: 20 } ] }); cp = viewport.getComponent('center-panel'); cp.items.items[0].show(); removeAndAdd(); }); function removeAndAdd() { cp.removeAll(); var tab = cp.add({xtype: 'panel', title: 'More testing', html: 'here we go...', closable: true}); cp.doLayout(); tab.show(); } </script> </head> <body> <div id="header">here goes the header</div> <div id="footer">and here is the footer</div> </body> </html>
-
21 Oct 2009 11:08 PM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 44
TabPanel onRemove assumes that the tab has already been removed from the items (but it will be removed after the call).
The easiest solution is probably to modify TabPanel.onRemove:
The SVN trunk should have the same fix applied (although it doesn't throw a javascript error like the 3.0.x branch does).Code:Ext.override(Ext.TabPanel, { 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); }else{ var count = this.items.getCount(); for(next = 0; next < count && this.getComponent(next) == c; next++){} if(next < count){ this.setActiveTab(next); }else{ this.activeTab = null; } } } this.delegateUpdates(); } });
-
6 Nov 2009 8:03 AM #3
This was actually caused by an erronous behaviour in getComponent. The issue has been fixed in SVN rev 5590.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
3 Dec 2009 1:41 AM #4
For those of us that don't have svn can we get the override fix for getComponent?
Also, I think you should release this in 3.0.4.
-
3 Dec 2009 1:46 AM #5
It will be a part of 3.1, it's coming out very shortly.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
3 Dec 2009 2:17 AM #6
I don't see how changing anything in getComponent fixes anything. Maybe there were more changes I'll wait and see I guess.
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote