Reputation: 377
I have an example fiddle in which I use Ext.window.Window
to edit the grid entries.
The id of the value is displayed in the grid itself, and empty in the edit window.
For combobox in the grid, I did this and it works
{
text : 'type',
dataIndex : 'type',
flex: 1,
renderer: function (v, p, record) {
return record.get('type');
},
},
For combobox in the form edit I added to the combobox listeners:{ render: function(combo)}
{
xtype: 'combobox',
store: {
type: 'type-store'
},
fieldLabel: 'Type',
displayField: 'name',
valueField: 'id',
queryMode: 'remote',
publishes: 'name',
name: 'name',
listeners:{
'render': function(combo){
console.log(combo);
combo.setValue();//How set current value
}
}
But I do not understand how to correctly set the current value?
thank
Upvotes: 0
Views: 58
Reputation: 1439
First things first, in order to link the value of the combo, your data data.json you must include the id for the "type", not just the description:
{
"id": 1, "id_type":3 , "type": "Третий", "mytextfield": "Текстовое значение"
},
You can actualy use the "name" if you want to, but you have to change your combo valueField to "name" also.
In the controller, first load the combo store (or autoload) and then, instead using the view_model of the windows, use the form to load your record:
console.log(wind.lookup("mycombo").getStore().load());
wind.down('form').loadRecord(record);
I modified your fiddle with those changes
Upvotes: 1