cancel tab after alert

Iam using grid version 1.6 and I have the following problem



mygrid1.attachEvent(“onEditCell”,function(stage,id,ind,value)

{



if(stage == 2)

{

if(ind == 0)

{

if(IsNAN(mygrid1.cells(id,0).getValue())

{

alert('Only numbers are allowed);

focusAfterAlert(mygrid1,id, ind);

}

}



return true;

}

return true;

});





function focusAfterAlert(grid,id, ind)

{

window.setTimeout(function(){

grid.selectCell(grid.getRowIndex(id),ind);

grid.editCell();

},0);

}



I am using the tab key to navigate through with the grid. Say i enter the word “ab” into cell 0 (which only accepts numbers) and i hit tab to move to the next cell. An alert pops up since its not a number now right after this happens the tab seems to go the next cell and then it comes back to cell 0. Is there a way to stop the tab if an alert is generated?





You can’t block “tab” key processing from the onEditCell event
Technically it possible to block edit operation for next cell in grid, but the focus still will be moved to next cell and code will require solution with setTimeout as existing one.

Grid allows fully redefine tab key processing logic, so you will be able to allow|deny next cell selection based on custom rules, but it will require complex custom coding - I can provide more detail if you interested.