PDA

View Full Version : Possible to create a layout and afterwards add items to it?



random0xff
22 Nov 2007, 3:35 PM
When I create an accordion like this:


var accordion = new Ext.Panel({
layout: "accordion",
title: "Accordion"
});

How can I add panels to it when not using the items config option?

I think the object accordion should have a property items of type Ext.util.MixedCollection (http://extjs.com/deploy/dev/docs/?class=Ext.util.MixedCollection). When I tried to use this property (accordion.items) is was undefined?

tryanDLS
22 Nov 2007, 3:51 PM
acccordion.add({title:'test',html:'abc'});
accordion.doLayout();

random0xff
23 Nov 2007, 1:21 AM
Thanks!

It's actually in the docs, but as usual I experiment without reading the docs first, doh!

Max Ishchenko
23 Nov 2007, 1:34 AM
Sometimes reading examples helps better than reading docs. Ext docs lack code snippets, I think.