Results 1 to 5 of 5

Thread: [2.0][SOLVED] Window destroy error with tabs and buttons

  1. #1
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976

    Exclamation [2.0][SOLVED] Window destroy error with tabs and buttons

    Hello,

    if you have a window (panel) with a tabpanel in it with several tabs, than there is an error thown while destroying the window (panel).

    Just close the window without switchting the tabs:
    "this.el has no properties
    var btn = this.el.child(this.buttonSelector);"



    Code:
    <html>
    <head>
    <link rel="stylesheet" type="text/css"  href="/css/ext-all.css" media="screen" id="theme"/>
    <script src="/script/ext-base.js" type="text/javascript"></script>
    <script src="/script/ext-all-debug.js" type="text/javascript"></script>
    <script>
    Ext.onReady(function(){
    	Ext.QuickTips.init();
    	new Ext.Window({
    		height: 200,
    		layout: "fit",
    		width: 200,
    		items: [{
    			xtype: "tabpanel",
    			activeTab: 0,
    			items: [{
    				title: "test",
    				buttons: [{
    					text: "test"
    				}]
    			},{
    				title: "test2",
    				buttons: [{
    					text: "test2"
    				}]
    			}]
    		}]
    	}).show();
    });
    </script>
    </head>
    <body>
    </body>
    </html>
    I think this happens because the buttons in the "not yet viewed tabs" arent rendered.

    If you switched the tabs before (got rendered) everything works fine.

    Tested in FF (latest) and IE7 on windows with ext2 final

    Sven

  2. #2
    Ext User
    Join Date
    Nov 2007
    Location
    Barcelona
    Posts
    193

    Thumbs up Use deferredRender on TabPanel

    You have the solution in your words:"I think this happens because the buttons in the "not yet viewed tabs" arent rendered."

    You are right, so to force the rendering in all tabs, you should use the deferredRender:false property on TabPanel:

    Code:
    ....................
    items: [{
        xtype: "tabpanel",
        activeTab: 0,
        deferredRender: false,
    ..................
    regards...

  3. #3
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976

    Default

    i know this one, but it isnt the best one

    But it should be fixed inside of ext. Something that isnt rendered cant be destroyed. So destroy shouldnt be called on the buttons in these "not yet viewed/rendered" panels.

  4. #4
    Ext User
    Join Date
    Nov 2007
    Location
    Barcelona
    Posts
    193

    Thumbs up Patch(override) Ext.Button::beforeDestroy

    I agree with you...

    If the TabPanel behaviour is to can have a deferred rendering or not, then , when destroying the items, it should be taken in account: only destroy what can be destroyed, or with yourself words:Something that isn't rendered can't be destroyed

    A patch can be:
    Code:
    Ext.override(Ext.Button,{
        beforeDestroy: function(){
            if (this.el){
                var btn = this.el.child(this.buttonSelector);
                if(btn){
                    btn.removeAllListeners();
                }
            }
            if(this.menu){
                Ext.destroy(this.menu);
            }
        }
    });
    I also think this can be added/fixed inside Ext (of course, it should be validated by Ext Core Developers).
    Regards...

  5. #5
    Sencha User
    Join Date
    Apr 2012
    Location
    Austin, Texas
    Posts
    4

    Default

    This has already been reported and fixed in SVN.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •