PDA

View Full Version : Edit Grid specialKey listener - IE



ust
7 Jul 2010, 2:02 AM
Hi,

I have an edit-grid which has Ext.form.NumberField as editors. I have defined a specialKey listener to capture arrow keys. Based on the arrow key, I start the grid editing for corresponding cell. Something like:


function handleSpecialKey(o, e) {
var rowSelected = grid.activeEditor.row;
var colSelected = grid.activeEditor.col;
switch(e.getKey()){
case e.LEFT : try{
grid.startEditing (rowSelected, colSelected - 1);
}catch(e) {}
break;
case e.RIGHT: try{
grid.startEditing (rowSelected, colSelected + 1);
}catch(e) {}
break;
case e.UP : try{
grid.startEditing (rowSelected - 1, colSelected);
e.preventDefault();

}catch(e) {}
break;
case e.DOWN : try{

grid.startEditing (rowSelected + 1, colSelected);
e.preventDefault();
}catch(e) {}
break;
}
}
I have two issues in IE:
1) When arrow key (UP or DOWN) are pressed continuously, the listener is activated only initially (for one or two cells). Then the window scrolls vertically instead of grid.startEditing for the cell. Note, if the arrow keys are pressed slowly, then this behavior is controlled with the help of e.preventDefault();
2) I am using "selectOnFocus: true" in the editor. Still, I see that sometimes when the cells get focus, the text inside the cell is not selected.

Both these issues occur only in IE and not in Firefox. Any help is greatly appreciated.

Thanks in advance.