Skip to content

Instantly share code, notes, and snippets.

@zerkms
Last active October 4, 2015 03:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zerkms/2572486 to your computer and use it in GitHub Desktop.
Save zerkms/2572486 to your computer and use it in GitHub Desktop.
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