PDA

View Full Version : [INFOREQ] EditorGridPanel -> IE8 -> edit next cell



tobiu
6 Jul 2010, 2:46 AM
hi team,

in firefox and chrome this works fine,
in ie8 it is somehow strange:

when ediding a cell and pushing the key enter, the cell in the next row gets transformed into the matched editor correctly and afterwards gets the focus. but, right after this, the cell loses the focus again and the editor closes.

i found out, that inside the method startEditing the last part causes this:



// Clear the selectSameEditor flag
(function(){
delete ed.selectSameEditor;
}).defer(50);


when i remove the delayed part, it works fine in ie8.
i have no clue though, why a delayed deleting of ed.selectSameEditor lets the cell lose focus.

any hints are greatly appreciated ;)


kind regards
tobiu

Jamie Avins
7 Jul 2010, 9:42 AM
Please provide a complete test case for this issue as there are many issues at play when it comes to this particular behavior.

tobiu
19 Jul 2010, 6:24 AM
Hi Jamie,

i was on this for quite a long time. I set up 2 testcases, but both worked fine in IE 8.
So, the conclusion is, that this only causes problems in really big grids, with many columns and custom renderers.

If your grid just gets complex enough, especially in the slow IE 8, the delay of 50ms is just not enough.

i changed the code now to:


// Clear the selectSameEditor flag
(function(){
delete ed.selectSameEditor;
}).defer(200);


which works fine. it could be a good idea to change it globally, since 0.2s is still fast.

otherwise, after the new cell got selected, the method onEditComplete got called again without doing anything.


kind regards
tobiu

madirishman
2 Sep 2010, 9:59 AM
I'm having a similar problem. Where did you edit the code?


// Clear the selectSameEditor flag
(function(){
delete ed.selectSameEditor;
}).defer(50);
Did you edit it in ext-all-debug.js, or did you somehow override it in your grid code?

tobiu
3 Sep 2010, 12:28 AM
hi madirishman,

changing the ext-all or ext-all-debug directly is not an option.
my override is also really bad: 64 lines of code just to change 1 line. but i don't think a shorter override is possible. so, we have to check this one very carefully on each ext-upgrade.

we can only hope, the team will take a closer look on the general issue (using defer is a workaround in most cases and there is no guarantee that 200ms will be enough for all usecases). well, since there are opening way more tickets then tickets get resolved, this can take a while. it seems that only sencha and ext4 get the focus, probably not enough manpower...


kind regards,
tobiu




// only increased defer(50) to defer(200)
Ext.override(Ext.grid.EditorGridPanel, {
startEditing : function(row, col){
this.stopEditing();
if(this.colModel.isCellEditable(col, row)){
this.view.ensureVisible(row, col, true);
var r = this.store.getAt(row),
field = this.colModel.getDataIndex(col),
e = {
grid: this,
record: r,
field: field,
value: r.data[field],
row: row,
column: col,
cancel:false
};
if(this.fireEvent("beforeedit", e) !== false && !e.cancel){
this.editing = true;
var ed = this.colModel.getCellEditor(col, row);
if(!ed){
return;
}
if(!ed.rendered){
ed.parentEl = this.view.getEditorParent(ed);
ed.on({
scope: this,
render: {
fn: function(c){
c.field.focus(false, true);
},
single: true,
scope: this
},
specialkey: function(field, e){
this.getSelectionModel().onEditorKey(field, e);
},
complete: this.onEditComplete,
canceledit: this.stopEditing.createDelegate(this, [true])
});
}
Ext.apply(ed, {
row : row,
col : col,
record : r
});
this.lastEdit = {
row: row,
col: col
};
this.activeEditor = ed;
// Set the selectSameEditor flag if we are reusing the same editor again and
// need to prevent the editor from firing onBlur on itself.
ed.selectSameEditor = (this.activeEditor == this.lastActiveEditor);
var v = this.preEditValue(r, field);
ed.startEdit(this.view.getCell(row, col).firstChild, Ext.isDefined(v) ? v : '');

// Clear the selectSameEditor flag
(function(){
delete ed.selectSameEditor;
}).defer(200); //here is the fix...
}
}
}
});

madirishman
3 Sep 2010, 5:19 AM
Thanks for the reply. Since my user base is internal and less than 20 people, I was successful in requiring firefox as a requirement for my system. I dont like it, since it makes me look bad, but it does run great. I decided to give up trying to debug the ie issue - it was very inconsistant, sometimes the longer defer worked and sometimes it didn't. I do have a lot of listeners happening on my grid, but the fact that it works great in firefox but not ie is pretty irritating.

Thanks,
md