Hybrid View

  1. #1
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,993
    Vote Rating
    212
    slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of

      0  

    Default [RC3] Flex -vs- width

    [RC3] Flex -vs- width


    I was thinking that if I set a flex property and a width property that the width property would override the flex in 4.0.x. Does that sound right? Maybe it's not.

    I did see, though, that in the documentation that in order to cancel flex you can use 0 or undefined. Seems in RC3 undefined isn't working to cancel flex, but 0 and null will.

    Code:
    Ext.widget('viewport', {
    	layout: {
    		type: 'hbox'
    		, align: 'stretch'
    	}
    	, defaults: { flex: 1 }
    	, items: [{
    		title: 'Panel 1'
    		, width: 100
    		, flex: undefined
                    //, flex: null
    	}, {
    		title: 'Panel 2'
    	}, {
    		title: 'Panel 3'
    	}]
    });

  2. #2
    Touch Premium Member svenna's Avatar
    Join Date
    Jun 2007
    Location
    Oslo,Norway
    Posts
    563
    Vote Rating
    26
    svenna has a spectacular aura about svenna has a spectacular aura about

      0  

    Default


    Flex overrides.. It does this in 4.0 also. I'm using it as a feature, I guess this would be a breaking change and sencha may want to wait to 5.x before doing a change like this.
    Sven Tore Iversen

  3. #3
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,993
    Vote Rating
    212
    slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of

      0  

    Default


    Oh, ok. Couldn't remember which overrode which.

    The flex: undefined not cancelling in RC3 is different, though, right? Documentation still says use 0 or undefined so I wonder if that is a bug in RC3?

  4. #4
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,616
    Vote Rating
    327
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    Initially 4.1 worked the other way round but it was switched to maintain compatibility. It should now behave the same as 4.0. I believes it's been this way for all the RCs.

    I don't think there's a bug here. The docs for flex appear to be correct about the use of an undefined value. However, in your example the flex is not undefined because it is overridden by the defaults. I don't believe anything has changed from 4.0 in that regard.

  5. #5
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,993
    Vote Rating
    212
    slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of

      0  

    Default


    I tried overriding the flex property with 0, null, and undefined in RC2 and each option resulted in the flex property overriding the config passed in by defaults. I did the same in RC3 and see that 0 and null override the defaults config, but undefined does not.

    As soon as I loaded up RC3 when it was released I my flex layouts with flex undefined were all failing so I checked out the docs to see if undefined was no longer valid as a way to dismiss it in the flex layout, but RC3 docs still say 0 and undefined are the way to go. I changed each failing instance with flex: null and it works to dismiss the container from the flex layout, but wondered if it was a bug since the docs still say undefined or 0.

  6. #6
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,616
    Vote Rating
    327
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    I've just tried this myself. It seems the priority switch occurred between RC1 and RC2, not before the RCs as I claimed previously.

    Using either RC2 or RC3 I get the same behaviour as 4.0.7.

    Perhaps we're reading different sections in the docs but I don't see a mistake. I'm looking at the docs for the config option flex, which appear to be correct to me. Using undefined as a flex value will cause it not to be flexed, however in your example the flex value is not undefined due to the use of defaults. I don't believe the way defaults are applied has changed at any point.

Thread Participants: 2