1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    4
    Vote Rating
    0
    tekkie00 is on a distinguished road

      0  

    Default Dynamically add panel to a card Layout

    Dynamically add panel to a card Layout


    I have a card layout which is configured on 1 tab within a tabPanel. This works fine if I have items:[] pre-configured and I can just call setActiveItem(index) to switch to the right card.

    Is there a way to add a panel to this card layout dynamically? For example, I need to load a specific "next" card depending on what button is tapped on the current card. Is this as easy as adding the panel to the items list? Do I need to reload or re-render anything?

    If there is a way to lazy-load (by default) the items in a card layout, that might be the ideal solution.

    Any takers?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    899
    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


    The setActiveItem can accept quite a few different types like a config object that will create the component, add the component and make it active in one call:

    Code:
    container.setActiveItem({
        xtype : 'form',
        items : [
            { xtype : 'textfield', label : 'Test' }
        ]
    });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1