开发者

How do I make a button in an Ext.FormPanel be width=100% with red text?

开发者 https://www.devze.com 2023-02-14 02:57 出处:网络
I have a form with a button at the end like this: var simple_form_right = new Ext.FormPanel({ frame:true,

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 do I make a button in an Ext.FormPanel be width=100% with 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');
    }
}

How do I make a button in an Ext.FormPanel be width=100% with red text?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消