Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha Premium Member
    Join Date
    Mar 2007
    Posts
    39
    Vote Rating
    0
    rmesser is on a distinguished road

      0  

    Default [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>

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    89
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    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:
    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();
        }
    });
    The SVN trunk should have the same fix applied (although it doesn't throw a javascript error like the 3.0.x branch does).

  3. #3
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,838
    Vote Rating
    609
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    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!

  4. #4
    Ext JS Premium Member
    Join Date
    Mar 2007
    Location
    Virginia, USA
    Posts
    504
    Vote Rating
    0
    vtswingkid is on a distinguished road

      0  

    Default


    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.

  5. #5
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,838
    Vote Rating
    609
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    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!

  6. #6
    Ext JS Premium Member
    Join Date
    Mar 2007
    Location
    Virginia, USA
    Posts
    504
    Vote Rating
    0
    vtswingkid is on a distinguished road

      0  

    Default


    I don't see how changing anything in getComponent fixes anything. Maybe there were more changes I'll wait and see I guess.