Check out the docs for getEditor()
on Ext.grid.column.Column
. If you are using an Editing plugin, the plugin provides implementation for getEditor()
, as well as setEditor()
. Based on column being edited and any custom logic you implement, you could implement a custom getEditor()
method to return whatever editor instance you want based on the circumstances.
The documentation says:
getEditor( record, defaultField ) : Ext.form.field.Field
This really tells a small part of the truth.
getEditor
is not only a method ofExt.grid.column.Column
, but also a config option.- If
getEditor
is defined as config option function get's called asgetEditor( record )
and needs to return aExt.grid.CellEditor
. - This will work with the cellediting plugin, but not with the rowediting plugin.
Here is an example of a column configuration. It will create a combobox only on selected rows :
columns: [{
text: 'Action', dataIndex: 'action',
getEditor: function(record){
if( my logic ){
return Ext.create('Ext.grid.CellEditor', {
field: Ext.create( 'Ext.form.field.ComboBox', {
forceSelection: true,
store: [[1, 'Option 1'], [2, 'Option 2']]
})
})
} else return false;
}
},