簡體   English   中英

如何使按鈕成為Ext.FormPanel字段行中的值?

[英]How can I make a button be the value in a Ext.FormPanel field row?

我有一個看起來像這樣的FormPanel:

var simple_form_left = new Ext.FormPanel({
    frame:true,
    labelWidth: 90,
    labelAlign: 'right',
    title: 'Customer Information',
    bodyStyle:'padding:5px 5px 0',
    width: 290,
    height: 600,
    autoScroll: true,
    itemCls: 'form_row',
    defaults: {width: 160},
    defaultType: 'displayfield',
    items: [{
    ...

現在,我想將此按鈕作為行之一的值放入:

var button = new Ext.Button({
    text: "Click this",
    handler: function() {
        alert('pressed');
    }
});

但是,當我將其添加為值時:

在此處輸入圖片說明

它只是將其顯示為一個對象:

在此處輸入圖片說明

我可以像這樣將其添加為完整字段行:

}, {
    fieldLabel: 'Item 15',
    name: 'item15',
    value: 'test'
}, button, {
    fieldLabel: 'Item 17',
    name: 'item17',
    value: 'test'
}, {

但這不是我想要的,因為它需要一個標簽:

在此處輸入圖片說明

如何添加按鈕來替換字段行中的文本?

附錄:

謝謝@Tommi,這是我要與您的解決方案一起使用的代碼:

在此處輸入圖片說明在此處輸入圖片說明

添加button對象作為一個項目,而不是添加DisplayField並且使按鈕value的的DisplayField 並在該按鈕上添加一個FieldLabel

暫無
暫無

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

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