PDA

View Full Version : How to center a button in a toolbar?



stone_leopard
29 Sep 2010, 9:01 AM
I'd like to create a toolbar with 2 buttons: 1 in the middle and one on the right. Here's what I attempted:



[ { xtype: 'spacer' }, centerButton, { xtype: 'spacer' }, rightButton ]


However, this makes the centerButton a little bit to the left of center. What would be the easiest way to accomplish this?

Thanks.

Tommes
29 Sep 2010, 10:00 AM
Try this:


var toolbar = new Ext.Toolbar({
dock: 'bottom',
layout:{
pack: 'center'
},
items: [{
xtype: 'button',
text: 'foobar',
handler: function(){
alert('ok');
}
}]
});

Tommes
29 Sep 2010, 10:10 AM
Hi, try this:


var toolbar = new Ext.Toolbar({
dock: 'bottom',
layout:{
pack: 'center'
},
items: [{
xtype: 'button',
text: 'foobar',
handler: function(){
alert('ok');
}
}]
});

mikeyroy
29 Sep 2010, 12:54 PM
[ { xtype: 'spacer' }, centerButton, rightButton ]