这是我的组合框配置
{
xtype : 'combo',
fieldLabel : 'Select Field',
displayField : 'field_name',
valueField : 'field_id',
id : 'fields_combo_id',
store: new Ext.data.JsonStore({
proxy : new Ext.data.HttpProxy({url:eyefind.config.DATA_RETRIEVAL, method:'GET'}),
baseParams: { subject: 'fields' },
root: 'data',
id: 'field_id',
fields: ['field_name'],
autoload: true
}),
labelStyle : 'font-weight:bold; width:100px',
triggerAction : 'all',
clearFilterOnReset : false,
mode : 'local'
}
我以这种方式在外部函数中加载商店:
.....
var comboFields = Ext.getCmp('fields_combo_id');
comboFields.store.load();
comboFields.setValue(selectedFieldId);
.....
到目前为止selectFieldId已设置但在可见部分我看到一个值而不是displayText,商店看起来很好,我有值:displayValue对正确设置在那里.
我的Ext版本是3.2.0.
解决方法:
你设置了valuefield:’field_id’,但是商店的字段中没有field_id,
{
xtype : 'combo',
fieldLabel : 'Select Field',
displayField : 'field_name',
valueField : 'field_id', //This 'field_id' must be in store fields too.
id : 'fields_combo_id',
store: new Ext.data.JsonStore({
proxy : new Ext.data.HttpProxy({url:eyefind.config.DATA_RETRIEVAL, method:'GET'}),
baseParams: { subject: 'fields' },
root: 'data',
id: 'field_id', //This id is just for the store, not the record data.
fields: ['field_id','field_name'], // here, i add `field_id`
autoload: true // This should be autoLoad, remember JavaScript is case sensitive.
}),
labelStyle : 'font-weight:bold; width:100px',
triggerAction : 'all',
clearFilterOnReset : false,
mode : 'local'
}
而且,为什么要设置autoLoad:如果在外部函数中再次加载它,则为true?
编辑
当我运行comboFields.setValue(id);,其中我的id被分配给一个字段id,它工作,我看到我的组合上的displayfield(不需要先下拉).但是,如果在您的情况下,您的组合项目已突出显示,我想这是因为版本.不幸
我在Ext 3.3.0中进行了测试.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。