簡體   English   中英

ExtJs 3.4:將組合的選定值連接到標簽文本中

[英]ExtJs 3.4 : Concatenate selected value of a combo into a label text

我在窗體面板中有一個Ext組合框,如下所示。

new Ext.form.ComboBox({
    store : routeStore,
    displayField : 'rName',
    valueField : 'rName',
    fieldLabel : 'Select Fixed Route',
    id : 'routeCombo',
    typeAhead : true,
        forceSelection : true,
    mode : 'local',
    triggerAction : 'all',
    selectOnFocus : true,
    editable : true,
    hidden : false,
    disabled : true,
    minChars : 1,
        hideLabel : true,
    width : 210,
    emptyText : 'Select Fixed Route'

})

還有我也有這樣的標簽。

{
        xtype : 'label',
        id : 'idTourCode',
        text : 'SystemDate',
        forId : 'myFieldId',
        style : 'marginleft:10px',
        //autoWidth : true,
        flex : 1
    }

現在,我需要將組合框的選定值連接到標簽文本。 此標簽已包含文本。 我想要的是,組合的選定值應連接到此標簽文本。 所有這些事情都應該在單擊按鈕時發生。

我試圖找到解決方案,但是沒有運氣。 因此,請足夠友好地幫助我澄清我的問題。

非常感謝

這是一個粗略的解決方法。

將此添加到您的組合框:

listeners: {
    change: function(box, newValue)
    {
        Ext.ComponentQuery.query("#myLabel")[0].setText(newValue)
    }

將此添加到您的標簽:

itemId: 'myLabel'

您應該對此加以改進,並找到比Ext.ComponentQuery更好的訪問組合框,因為它確實很慢。

暫無
暫無

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

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