Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by ez on Oct 19, 2009 05:58
open dhtmlx forum
How to switch current edited cell?

I would like to know to switch current edited cell in a row?

Example:

On "onEditCell" on 2 cell switch editor to cell 1 edit when cell 1 is empty (cell 1 value is necessary for cell 2 editor).

I try this approach:


grid.attachEvent("onEditCell", function(stage,rowId,cIndex,nValue,oValue){    
             if(stage==0 && cIndex==1){
                 var ODD = grid.cellById(rowId,0).getValue();
                 if(ODD=='') {
                     alert("Fill cell 1 first!");
grid.selectCell(grid.getRowIndex(rowId), 0, true, false, true, true);
                     return false;
                 }
             }
}
Answer posted on Oct 19, 2009 07:44

Please try to change you code like that:

grid.attachEvent("onEditCell", function(stage,rowId,cIndex,nValue,oValue){
if(stage==0 && cIndex==1){
var ODD = grid.cellById(rowId,0).getValue();
if(ODD=='') {
alert("Fill cell 1 first!");
window.setTimeout(function(){
grid.selectCell(grid.getRowIndex(rowId), 0, true, false, true, true);
},1);

return false;
}
else return true;
}
}