Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-8291 in 4.2.1.744.
  1. #1
    Ext JS Premium Member GustavR's Avatar
    Join Date
    Jun 2009
    Posts
    37
    Vote Rating
    18
    GustavR will become famous soon enough

      0  

    Default [4.2.0.265] Ext.Component: show() results in two layout runs if autoRender true

    [4.2.0.265] Ext.Component: show() results in two layout runs if autoRender true


    REQUIRED INFORMATION
    Ext version tested:
    • Ext 4.1.2.1
    • Ext 4.2.0.265
    Description:
    • When calling show() on a Ext.Component that has floating or autoRender its Layout is done twice!
    Steps to reproduce the problem:
    • Create Ext.window.Window
    • Show it (using show())
    The result that was expected:
    • Layout is run once
    The result that occurs instead:
    • Layout is run twice
    Test Case:
    Code:
    w = Ext.create('Ext.window.Window');
    
    layoutCountBefore = w.layoutCounter;
            
    w.show();
            
    w.layoutCounter - layoutCountBefore; // 2


    HELPFUL INFORMATION

    Possible fix:
    Code:
    Ext.define('Ext.fix.Component', {
        override: 'Ext.Component',
        
        show: function(animateTarget, cb, scope) {
            var me = this,
                rendered = me.rendered;
    
            if (rendered && me.isVisible()) {
                if (me.toFrontOnShow && me.floating) {
                    me.toFront();
                }
            } else {
                if (me.fireEvent('beforeshow', me) !== false) {
                    // Render on first show if there is an autoRender config, or if this is a floater (Window, Menu, BoundList etc).
                    me.hidden = false;
                    if (!rendered && (me.autoRender || me.floating)) {
                        var autoRendered = true;
                        Ext.suspendLayouts();
                        me.doAutoRender();
                        rendered = me.rendered;
                        // there was no rendering done, so set autoRendered back to false and resume layouts
                        if (!rendered) {
                            autoRendered = false;
                            Ext.resumeLayouts();
                        }
                    }
                
                    if (rendered) {
                        me.beforeShow();
                        me.onShow.apply(me, arguments);
                        if (autoRendered) {
                            autoRendered = false;
                            Ext.resumeLayouts(true);
                        }
                        me.afterShow.apply(me, arguments);
                    }
                } else {
                    me.onShowVeto();
                }
            }
            return me;
        }
    });
    A smaller fix would be the following, but it has its downside that you have to use it everywhere you show a window:
    Code:
    w = Ext.create('Ext.window.Window');
    Ext.suspendLayouts();
    w.show();
    Ext.resumeLayouts(true);
    w.center();

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,073
    Vote Rating
    854
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Thanks for the report! I have opened a bug in our bug tracker.

Thread Participants: 1