Threaded View

  1. #16
    Ext JS Premium Member
    Join Date
    May 2009
    Posts
    41
    Vote Rating
    0
    maksimenko is on a distinguished road

      0  

    Default


    Hello Don,

    Thanks again for your response,

    That helped!

    Using the following code worked perfectly and I'm able to test the app running in 4.1 (I've changed all my overrides to this form)
    Code:
    Ext.define('MM.patch.layout.container.Fit', {   
        override: 'Ext.layout.container.Fit',    
        
        calculate: function (ownerContext) {        
            console.log('override called');
            var me = this,
                childItems = ownerContext.childItems,
                /* begin workaround */
                //length = childItems.length,
                length = childItems !== undefined ? childItems.length : 0,
                /* end workaround */
                targetSize = me.getContainerSize(ownerContext),
                contentSize = { width: 0, height: 0 },
                i;
    
    
            for (i = 0; i < length; ++i) {
                me.fitItem(ownerContext, childItems[i], targetSize, contentSize);
            }
    
    
            if (!ownerContext.setContentSize(contentSize.width, contentSize.height)) {
                me.done = false;
            }
        }
    });
    But just to let you know, using the following code (the < 4.1 way, without the Ext.define('..', { override: ... }) don't...
    Code:
    Ext.override('Ext.layout.container.Fit', {        
          calculate: function (ownerContext) {        
                console.log('override called');
                var me = this,
                childItems = ownerContext.childItems,
                /* begin workaround */
                //length = childItems.length,
                length = childItems !== undefined ? childItems.length : 0,
                /* end workaround */
                targetSize = me.getContainerSize(ownerContext),
                contentSize = { width: 0, height: 0 },
                i;
    
    
            for (i = 0; i < length; ++i) {
                me.fitItem(ownerContext, childItems[i], targetSize, contentSize);
            }
    
    
            if (!ownerContext.setContentSize(contentSize.width, contentSize.height)) {
                me.done = false;
            }
        }
    });
    Don't know if it should be filed as a bug or not... what's even weirder is that I had an override in this old form for the ComboBox constructor and it worked fine there...

    Now that I understand the new way, I quite like it, it's cleaner and easier to include/exclude on builds.

    Thanks again for your help throughout this issue
    Last edited by maksimenko; 3 Nov 2011 at 12:35 PM. Reason: code new lines fix