Last active
October 4, 2015 03:48
-
-
Save zerkms/2572486 to your computer and use it in GitHub Desktop.
Extjs grid CellEditing triggered by F2 plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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); | |
} | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Change in line 23
to
see http://docs.sencha.com/ext-js/4-1/#!/api/Ext.EventObject-property-F2