2014-01-10 74 views
0

我在表單面板中有一個分機組合框,如下所示。ExtJs 3.4:將組合的選定值連接到標籤文本

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 
    } 

現在我需要將選定的組合框的值連接到我的標籤文本。這個標籤已經有一個文本。我想要的是,組合的選定值應連接到此標籤文本。所有這些事情都應該發生在點擊按鈕上。

我試着找到一個解決方案,但沒有運氣。因此,請善舉來幫助我澄清我的問題。

非常感謝

回答

1

這是一個粗略的修復。

添加到您的組合框:

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

添加到您的標籤:

itemId: 'myLabel' 

您應該擦亮這一點,並找到更好的訪問你的ComboBox比Ext.ComponentQuery,因爲它真的很慢。

相關問題