I have a grid and want to use a combobox as a grid cell editor. The value of the editor combobox should depend on multiple fields in my data record, so I am trying to set the value of the combobox in the grid's beforeEdit
listener, like so:
beforeEdit: function (editor, e, options) {
var field = e.field;
var combo = e.grid.columns[e.colIdx].getEditor(e.record);
var force = e.record.get('forced');
switch (force) {
case 'Y':
combo.setValue("Force active");
break;
case 'N':
combo.setValue("Force inactive");
break;
default:
combo.setValue("Default");
break;
}
}
My combobox is defined like so, so it contains each of the possible options shown in my beforeEdit
handler:
editor: {
xtype: 'combobox',
forceSelection: true,
editable: false,
triggerAction: 'all',
allowBlank: false,
store: [ 'Default', 'Force active', 'Force inactive' ]
}
My problem is that though the correct entry is selected in the dropdown, the text portion of the combobox remains empty.
How can I convince the editor combobox to also display the value in the textbox portion of the combo?
Here's a sencha fiddle with a scratchpad for this: https://fiddle.sencha.com/#fiddle/9vd