I have a form with a button at the end like this:
var simple_form_right = new Ext.FormPanel({
frame:true,
labelWidth: 90,
labelAlign: 'right',
title: 'Orderer Information',
bodyStyle:'padding:5px 5px 0',
width: 300,
height: 600,
autoScroll: true,
itemCls: 'form_row',
defaultType: 'displayfield',
items: [{
fieldLabel: 'Customer Type',
开发者_Python百科 name: 'customerType',
allowBlank:false,
value: 'Company'
}, .... {
fieldLabel: 'Item 21',
name: 'item21',
value: 'test'
},
new Ext.Button({
text: "Cancel Order",
style: 'width: 100%; color: red',
handler: function() {
alert('pressed');
}
})
]
});
The button works but as the style information attempt indicates, I would like the button to extend across the form and have red text.
How can I make the button's width extend across the form and have red text inside the button?
Addendum
Robby's solution works 100%:
...
}, {
fieldLabel: 'Item 20',
name: 'item20',
value: 'test'
}, {
fieldLabel: 'Item 21',
name: 'item21',
value: 'test'
}, {
xtype: 'button',
text: '<span style="color:red">Cancel Order</span>',
anchor: '100%',
handler: function() {
alert('pressed');
}
}
Change your button definition to.
{
xtype: 'button',
text: '<span style="color:red;">Cancel Order</span>',
anchor: '100%'
handler: function() { alert('pressed') };
}
For the anchor property to work your button can't be in the 'buttons' array of a panel.
精彩评论