我将我的应用程序从ExtJs 3迁移到4版本。 我有几个组合框在我的formPanel,以前我用隐藏名称 和所有stuff提交valueField而不是displayField。Extjs 4 combobox默认值
我的所有适应都可以正常工作(值域是提交),但我无法设置组合框的默认值,它们在页面加载后显示为空。 以前,我只是在config中指定了'value'参数。 有没有什么想法如何解决这个问题?
我的代码 - 型号和商店:
Ext.define('idNamePair', {
extend: 'Ext.data.Model',
fields: [
{name: 'id', type: 'string'},
{name: 'name', type: 'string'}
]
});
var dirValuesStore = new Ext.data.Store({
model: 'idNamePair',
proxy: {
type: 'ajax',
url: '../filtervalues.json',
reader: {
type: 'json',
root: 'dir'
}
},
autoLoad: true
});
组合配置:
{
triggerAction: 'all',
id: 'dir_id',
fieldLabel: 'Direction',
queryMode: 'local',
editable: false,
xtype: 'combo',
store : dirValuesStore,
displayField:'name',
valueField:'id',
value: 'all',
width: 250,
forceSelection:true
}
请张贴一些示例代码,让我们来看看这个问题,一个可能的解决方案。 –
问题恰恰在于。没有代码需要,即使我不知道答案,因为我仍然卡在3.x – sra
我想这又是一个异步加载存储和组合的问题,因为如果商店是在组合内定义的 - 它工作正常。 – BlackLine