Skip to content

Instantly share code, notes, and snippets.

@zerkms
Last active October 4, 2015 03:48
Embed
What would you like to do?
Extjs grid CellEditing triggered by F2 plugin
/*
* ExtJS Grid plugin that triggers CellEditing on F2 in addition to clicks and Enter
*
* License: GPL
* Author: Ivan Kurnosov
*/
Ext.define('Ext.grid.plugin.CellEditingF2', {
alias: 'plugin.celleditingf2',
extend: 'Ext.grid.plugin.CellEditing',
requires: ['Ext.grid.plugin.CellEditing'],
initEvents: function() {
this.callParent();
this.initF2Handler();
},
initF2Handler: function() {
var me = this,
grid = me.grid,
view = grid.view;
view.addElListener('keydown', function(e) {
if (e.keyCode == e.F2) {
var columnId = grid.getSelectionModel().getCurrentPosition().column,
record = grid.getSelectionModel().selection.record,
header = view.getHeaderAtIndex(columnId);
me.startEdit(record, header);
}
});
}
});
@MorrisJobke
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment