PDA

View Full Version : How to center an item in tbar without distrubing other items



stehen09
26 Feb 2010, 4:24 AM
im having a tool bar
new Ext.Toolbar({
items: [{
text:'item1 left most'
},{
text:'item2 center',
align:'center'
},'->',{
xtype:'item3 right'
},{
text:'item4 right most'
}]
});

Im not able to align the item named 'item2 center' at the center of the tool bar.. with out changing the alignment of other items.
i tried using   but its not the right way i belive..
could anyone help me to place that item at center of d tbar?.

maquejp
26 Feb 2010, 4:41 AM
{
xtype: 'button',
text: 'PDF Original Proposal',
tooltip: 'PDF Original Proposal',
style:'marginLeft:100px',
handler: function(){

}
}

Inspiring?

stehen09
26 Feb 2010, 5:02 AM
yeah!!! thanx nice solution..

but here we should not hard code right..?
"style:'marginLeft:100px',"
if we are seeing it in different monitors it wont give us exact center position.

stehen09
26 Feb 2010, 6:38 AM
now i got some solution,

'marginLeft:'+ Ext.getBody().getViewSize().width/2+'px';

israeldelahoz
16 May 2010, 7:35 AM
width/4 worked for me,in all screen resolution