1
votes

I am new to EXTJS. Please help me with the below problem. I have a cellEditingPlugin with selection model as cell editing on a grid panel. I am trying to catch the specialkeyevent on editor for the arrow keys and change the editable cell accordingly. I am using startEditByPosition function to achieve this. It works when i navigate left and right in the same but when i move to the above/below row, the cell in the above/below row loses edit mode. I tried to catch the focus event on the editor, but the focus event is not raised in case when i move other rows. Please help me. Below is the snippet.I am using 4.0 version.

function specialkeyfunction(obj,e)// event handler
{
console.log("special key event");
var grid = Ext.getCmp('gridItems');
var code = e.getCharCode ();
var rowSelected = grid.view.getSelectionModel().getCurrentPosition().row;
var colSelected = grid.view.getSelectionModel().getCurrentPosition().column;
     if (code == "37")
     {
     if(colSelected>1)
     grid.plugins[0].startEditByPosition({row:rowSelected,column:colSelected-1}); 
     }
     else if (code == "39")
     {
     if(colSelected<(maxColumns-1))
     grid.plugins[0].startEditByPosition({row:rowSelected,column:colSelected+1});
     }
     else if (code == "38")
     {
     if(rowSelected>0)
     grid.plugins[0].startEditByPosition({row:rowSelected-1,column:colSelected});
     }
     else if (code == "40")
     {
     if(rowSelected<(maxRows-1))
     grid.plugins[0].startEditByPosition({row:rowSelected+1,column:colSelected});
     }
     else 
     {
     } 
 }
1

1 Answers

0
votes

this worked for me grid.plugins[0].startEditByPosition({'row':9,'column':0});