2016-03-07 158 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