Ext.define('Ext.grid.plugin.CellEditing', {
alias: 'plugin.cellediting',
extend: 'Ext.grid.plugin.Editing',
- requires: ['Ext.grid.CellEditor'],
+ requires: ['Ext.grid.CellEditor', 'Ext.util.DelayedTask'],
constructor: function() {
<span id='Ext-grid-plugin-CellEditing-event-beforeedit'> /**
this.editors = Ext.create('Ext.util.MixedCollection', false, function(editor) {
return editor.editorId;
});
+ this.editTask = Ext.create('Ext.util.DelayedTask');
+ },
+
+ onReconfigure: function(){
+ this.editors.clear();
+ this.callParent();
},
<span id='Ext-grid-plugin-CellEditing-method-destroy'> /**
*/
destroy: function() {
var me = this;
+ me.editTask.cancel();
me.editors.each(Ext.destroy, Ext);
me.editors.clear();
me.callParent(arguments);
me.setActiveColumn(columnHeader);
// Defer, so we have some time between view scroll to sync up the editor
- Ext.defer(ed.startEdit, 15, ed, [me.getCell(record, columnHeader), value]);
+ me.editTask.delay(15, ed.startEdit, ed, [me.getCell(record, columnHeader), value]);
} else {
// BrowserBug: WebKit & IE refuse to focus the element, rather
// it will focus it and then immediately focus the body. This
// temporary hack works for Webkit and IE6. IE7 and 8 are still
// broken
- me.grid.getView().el.focus((Ext.isWebKit || Ext.isIE) ? 10 : false);
+ me.grid.getView().getEl(columnHeader).focus((Ext.isWebKit || Ext.isIE) ? 10 : false);
}
},
getEditor: function(record, column) {
var me = this,
editors = me.editors,
- editorId = column.itemId || column.id,
+ editorId = column.getItemId(),
editor = editors.getByKey(editorId);
if (editor) {
me.context.record.set(dataIndex, value);
// Restore focus back to the view's element.
} else {
- grid.getView().el.focus();
+ grid.getView().getEl(activeColumn).focus();
}
me.context.value = value;
me.fireEvent('edit', me, me.context);
cancelEdit: function() {
var me = this,
activeEd = me.getActiveEditor(),
- viewEl = me.grid.getView().el;
+ viewEl = me.grid.getView().getEl(me.getActiveColumn());
me.setActiveEditor(null);
me.setActiveColumn(null);