簡體   English   中英

如何在Ext.FormPanel中使按鈕的寬度等於100%並帶有紅色文本?

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

我有一個窗體的末尾有一個按鈕,像這樣:

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',
                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');
                }
            })
        ]
    });

該按鈕有效,但是如嘗試的樣式信息所指示,我希望該按鈕在表單延伸並具有紅色文本

在此處輸入圖片說明

如何使按鈕的寬度在整個表單上延伸,並且按鈕內有紅色文本?

附錄

羅比的解決方案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');
    }
}

在此處輸入圖片說明

將按鈕定義更改為。

{
    xtype: 'button',
    text: '<span style="color:red;">Cancel Order</span>',
    anchor: '100%'
    handler: function() { alert('pressed') };
}

為了使anchor屬性起作用,您的按鈕不能位於面板的“ buttons”數組中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM