2012-12-20 61 views
0

我有一個組合框和模型組合框。當用戶選擇一個make時,make combo加載信息。問題是,當用戶關閉組合框時它不會觸發。當他們按下回車鍵或者他們用鼠標從列表中選擇一個項目時,它會工作。以下是我們爲化妝組合:依賴組合框不爲標籤在ExtJS中燒製

new Ext.form.ComboBox({ 
    id: 'ddlMake', 
    store: makeStore, 
    displayField: 'Description', 
    valueField: 'MakeOid', 
    width: 175, 
    typeAhead: true, 
    mode: 'local', 
    forceSelection: true, 
    triggerAction: 'all', 
    emptyText: 'Select a make', 
    selectOnFocus: true, 
    allowBlank: false, 
    listeners: 
     { 
      select: function(combo, record, index) { 
       LoadModelCombo(combo, record, index); 
       FillAircraftType(); 
      } 
     } 
+0

如果你使用這個字段爲源動力的模型組合的價值,爲什麼不盯緊了'change'事件而不是'select'事件?這些文檔有點令人困惑,這意味着這隻會在您調用'setValue'方法時觸發,但它也觸發用戶在UI中的選擇。 –

+0

所以你說默認偵聽器只是爲了選擇事件?我認爲我真正需要的是聆聽模糊。 ExtJS中的等價物是什麼?非常感謝你的幫助。 –

+0

我不知道你的意思是「默認偵聽器」。從你的描述中聽起來你應該對change事件感興趣,而不是select事件。看起來你有興趣更新模型組合的UI,即使make combo從不失去焦點,所以模糊也許不是最佳選擇。 –

回答

0

這是我最終使用的。我用這兩個選擇和更改:

new Ext.form.ComboBox({ 
    id: 'ddlMake', 
    store: makeStore, 
    displayField: 'Description', 
    valueField: 'MakeOid', 
    width: 175, 
    typeAhead: true, 
    mode: 'local', 
    forceSelection: true, 
    triggerAction: 'all', 
    emptyText: 'Select a make', 
    selectOnFocus: true, 
    allowBlank: false, 
    listeners: { 
     select: function (combo, record, index) { 
      LoadModelCombo(combo, record, index); 
      FillAircraftType(); 
     }, 
     change: function (combo, record, index) { 
      LoadModelCombo(combo, record, index); 
      FillAircraftType(); 
     } 
    } 
}), 
-1

使用ComboBox組件的forceSelection config屬性,這將使你才達到你想要的。休息你可以看到這個配置的sencha文檔

+0

使這成爲真實 – arshabh