2016-03-07 163 views
-1

我試圖設置使用商店的組合框的默認值。我嘗試過value,defaultValue並試過afterrender,但似乎沒有任何效果。有沒有人遇到過同樣的問題?任何幫助,將不勝感激。設置組合框的默認值

+0

我不知道爲什麼,我的問題是用戶在這裏降級。我已經把所有的信息。那麼沒有解決方案爲我工作。 – ashhad

回答

2
// The data store containing the list of states 
var states = Ext.create('Ext.data.Store', { 
    fields: ['abbr', 'name'], 
    data : [ 
     {"abbr":"AL", "name":"Alabama"}, 
     {"abbr":"AK", "name":"Alaska"}, 
     {"abbr":"AZ", "name":"Arizona"} 
    ] 
}); 


Ext.create('Ext.form.ComboBox', { 
    fieldLabel: 'Choose State', 
    store: states, 
    queryMode: 'local', 
    displayField: 'name', 
    valueField: 'abbr', 
    value: 'AL', // the value should be an existing store's valueField 
    renderTo: Ext.getBody() 
}); 
+0

我已經完成了。不工作仍然。感謝 – ashhad

+0

請發佈您的代碼。這樣人們就能在你的代碼中找出問題。 – Harshal