PDA

View Full Version : Cellediting and sync



herzog
2 Oct 2012, 12:35 AM
Hi,

following scenario:

1. Click editable cell: The selected cell got focus and the editor appears. The value is selected. I can overwrite it.
2. I change the value and make a click on the next editable cell: The sync of the grid started. The selected cell got focus and the editor appears. The value is selected. Now (I think) the sync finished and the editor is loosing focus. I need to click the cell again!

Any Ideas how to avoid the need to reclick the cell?

Thank you.

Christian



plugins: ['headertooltip', Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1, listeners: { edit: function (editor, e, eOpts) { Ext.getCmp('grid').getStore().sync(); } } })],

hiroprotagonist
2 Oct 2012, 4:40 AM
Hi,

I've experienced the same issue and fixed it like this:



Ext.define('Sample.grid.tree.View', {
extend: 'Ext.tree.View',
alias: 'widget.samplegridtreeview',
initComponent: function () {
this.callParent(arguments);
},
/*
* This method is used to ensure that the cursor on the grid is shown anytime.
* Cursor is removed for some reason by commit method in operation class by overriding the data property of the html table cell.
*/
onUpdate: function () {
var me = this,
sm = me.getSelectionModel();
if (sm.setCurrentPosition) {
sm.setCurrentPosition(sm.getCurrentPosition());
}

me.callParent(arguments);
}
}


The point here seems to be that the cell does loose its focus when the commit method of the record was called. This leads to an update call that I use to just set the focus on the current position again. In my case this was the tree view as I use the Tree Panel component. You'll have to change that to your kind of grid view you use.

hth,
regards
Hiro.