1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    25
    Vote Rating
    0
    Answers
    1
    grnadav is on a distinguished road

      0  

    Default Unanswered: Applying flex after component creation

    Unanswered: Applying flex after component creation


    Hello

    When I try to apply flex to a component that's already been initialized, it does not affect (looking through the source I see that it doesn't have any listeners on it and the flex is only applied during creation.

    A side affect of that is that I wrap the component with a dummy container and give that container flex (because I control it's creation time)

    Is it a bug or a feature?

    Thanks!

  2. #2
    Sencha - Sencha Touch Dev Team rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,158
    Vote Rating
    6
    Answers
    93
    rdougan will become famous soon enough

      0  

    Default


    There is no way to do this at the component/item level. You need to access the containers layout and set it using that. You can do this using the following code:

    Code:
    container.getLayout().setItemFlex(item, 3);
    Where container is your container, item is the item you want to change the flex on, and 3 is the new flex you want to set.

    There are no docs for this in PR4 unfortunately, but there will be in the next release.
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

  3. #3
    Sencha Premium Member
    Join Date
    Aug 2011
    Posts
    168
    Vote Rating
    2
    Answers
    1
    GertBoers is on a distinguished road

      0  

    Default


    When I try this:

    PHP Code:
    Ext.define('Delen0001.view.Dashboard', {
        
    extend'Ext.Container',
        
    xtype'dashboard',     
        
    config:{
            
    fullscreentrue,  
            
    layout: {
                
    type'vbox',
                
    pack'center'
            
    },
            
    id'testje',
            
    items:[
                {
                
    xtype'panel',
                
    id'blockone',
                
    items:[
                        {
                        
    xtype'toolbar',
                        
    title"Delen Today",        
                        },
                    ],
                
    flex1,
                
    listeners: {
                
                    
    tap: function() {
                    
                        
    Delen0001.view.Dashboard.getLayout().setItemFlex('blockone',0);
                    },
                    
    element'element'
    ... 

    I get this error:

    Uncaught TypeError: Object function () { return this.constructor.apply(this, arguments); } has no method 'getLayout'


    Can anyone perhaps provide the correct syntax for this line:
    PHP Code:
    Delen0001.view.Dashboard.getLayout().setItemFlex('blockone',0); 
    Thanks

Thread Participants: 2

Tags for this Thread