Here is my combobox configuration
{
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'
}
I load the store in an external function in this way:
.....
var comboFields = Ext.getCmp('fields_combo_id');
comboFields.store.load();
comboFields.setValue(selectedFieldId);
.....
And so far selectedFieldId has been set but in the visible part I see a value instead of displayText, the store looks fine and I have the value:displayValue pair properly set there.
Do I miss something or do I have to use some other functionality for this part?
My version of Ext is 3.2.0.
You set
valuefield : 'field_id', but there is nofield_idin store’sfields,And also, why do you set
autoLoad : trueif you load it again in your external function?EDIT
When I run
comboFields.setValue(id);, in which my id is assign to one of the field id, it works, and I see displayfield on my combo (no need to dropdown first). But, if, in your case, your combo item has been highlighted, I guess it’s because of the version. UnfortunatelyI tested it in Ext 3.3.0.