Reputation: 9542
I got a extjs 4 combobox within a form bound to a model. I am binding data from grid to combo using form.loadRecord(record). The combobox is showing the valueField coming from the model assigned to the form instead of the displayField. The store of the combobox is preloaded. How can I achieve that the combobox shows the displayValue loading a record in the form?
{xtype:'combobox',
fieldLabel: 'category',
name: 'categorySelId',
store: 'Categories',
queryMode: 'local',
displayField: 'label',
valueField: 'id',
anchor:'96%',
loadMask: true,
typeAhead: true,
forceselection: true,
valueNotFoundText: 'Nothing found'}
The store is already used in the grid to show the column category
{ header: 'Category', dataIndex: 'categorySelectedId', flex:5,
renderer: function(value,metaData,record) {
if(value) {
var Categories = Ext.getStore('Categories');
var catRecord = Categories.findRecord('id', value);
return catRecord ? catRecord.get('label'): record.get('categorySelected');
} else return "";
}
},
Thx for your help!
Upvotes: 4
Views: 11227
Reputation: 9542
The problem was that I have not had configured the correct types in the model. Setting the right type in the model solved the problem. Thx sha for helping!
Upvotes: 5