Results 1 to 2 of 2

Thread: Dynamically add panel to a card Layout

  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    4
    Vote Rating
    0
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Vote Rating
    1272
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •