Im using a OnCellChanged event handler. Inside of this handler I need to validate the new data comparing it with other cells. If the new value is incorrect I need to delete the newValue (mygrid.cell(rowId,cellIndex).setValue("")), but this action generates an infite iteration (the handler is called infinite times). Is there any function that I can use to solve this problem? OnEditCellHandler is not usefull cause the cell is filled outside the grid without the cell editor.
The OnCellChanged is only event which react on direct cell data changing
You have three ways to solve problem
a) Complex and solid - create a custom excell
You can create a custom excell ( modify an existing one ) where necessary logic will be implemented exactly in setValue method
b) Mediocre - use some kind of flag
grid.attachEvent(“onCellChanged”,function(){
if (!window.skipNextTime){
window.skipNextTime=false;
… //any code here which can initiate onCellChanged event, because of flag, it will be skiped on next processing
window.skipNextTime=false;
}
});
c) Fast and dirty - direct assign
You can assign HTML value directly to DOM, this will not include possible text procession, but may work for simple editors
grid.cells(i,j).cell.innerHTML="";