PDA

View Full Version : Dynamically add panel to a card Layout



tekkie00
30 Apr 2012, 10:00 AM
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?

mitchellsimoens
2 May 2012, 5:44 AM
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:


container.setActiveItem({
xtype : 'form',
items : [
{ xtype : 'textfield', label : 'Test' }
]
});