PDA

View Full Version : Horizontal align Component in Container



mik3e
9 Feb 2012, 1:18 PM
Hi Guys,

Can anyone give me a hint, how to align a component horizontal to the right in a container? I´ve tried different ways but didn´t get it to work.

I need two columns where the items in the left column are aligned to the left and the items in the right columns are aligned to the right:

...
xtype: 'container',
layout: 'hbox',
items: [{
xtype: 'label',
text: 'Michael Fürst (m.fuerst@wolkenkraft.com)',
flex: 1
},{
xtype: 'container',
layout: 'hbox',
flex: 1,
align:'right',
// THIS ITEM SHOULD BE ALIGNED RIGHT:
items: [{
xtype: 'label',
text: 'Text'
}]
....

Thanks & Ciao,
Mike

mitchellsimoens
9 Feb 2012, 1:26 PM
layout : {
type : 'hbox',
pack : 'end'
}

mik3e
9 Feb 2012, 1:30 PM
Thanks for your answer, but it had no effect. I also changed the bg color of the container to see, if it´s spread completely to the right - and it is. So I´ve no idea where the problem could be at the moment. I also changed to column layout - no difference...


items: [{
xtype: 'container',
layout: 'column',
items: [{
xtype: 'label',
text: 'Text align left)',
columnWidth: 0.5
},{
xtype: 'container',
layout: 'hbox',
columnWidth: 0.5,
pack:'end',

style: {
background: '#ff0000'
},
items: [{
xtype: 'label',
text: 'Test align right'
}

landed
13 Apr 2012, 3:55 AM
This may be of help ?

http://www.sencha.com/forum/showthread.php?190023-Problems-with-align-to-right-or-end