PDA

View Full Version : automatically one or two rows for two pannels in a container



eternasparta
20 Feb 2013, 6:14 AM
i've a container with two panels inside, very similar to the following example code:
{xtype : 'container',
id:'mycon'
width:400,
items:[
{xtype:'panel',
id:'firstpanel',
width:350, height:200},
{xtype:'panel',
id:'secondpanel',
width:350, height:200}
]}
and my pannels are in two different row as it was expected
41959
but if i try to change their width to 150:

{xtype:'panel',
id:'firstpanel',
width:150, height:200},
{xtype:'panel',
id:'secondpanel',
width:150, height:200}
41961

why they are still in two nows? I would have them in a single row if firstpanel.width+secondpanel.width<mycon.width; else in two rows

And is it possible compute it dinamically (for example if i change dinamically the width of mycon to 200 with each panel width:150; or the width of a panel dinamically from 150 to 350)?

Thank you!

scottmartin
20 Feb 2013, 6:52 AM
Layouts have to be set at config and cannot be changed dynamically. To have side by side, your parent would need a layout of 'hbox'

Scott.

eternasparta
20 Feb 2013, 11:48 PM
thank you scott, but i've solved using layout: 'column'