PDA

View Full Version : How do I get two buttons to display side by side?



profunctional
19 Feb 2011, 1:08 PM
When I add them to a form, they display one on top of the other. I'd like one to be on the left and one to be on the right. Thanks in advance.

mitchellsimoens
19 Feb 2011, 6:30 PM
I add a container as an item to the formpanel with layout as hbox. That works pretty well for me.

profunctional
20 Feb 2011, 6:06 AM
Thanks Mitchell, I will give that a shot.

Nicodemuz
20 Feb 2011, 8:13 PM
I was struggling with this for a while too, but ended up with the following code:


layout: {
type: 'hbox'
},

items: [{
xtype: 'spacer',
}, {
layout: {
type: 'hbox'
},
items: [{
xtype: 'button',
ui: 'confirm',
text: 'Button 1'
},{
xtype: 'spacer',
// The amount of spacing between buttons
width: 20
}, {
xtype: 'button',
ui: 'action',
text: 'Button 2'
}]
}, {
xtype: 'spacer',
}]