DHTMLX Docs & Samples Explorer

onEditCell Event

This event occurs 1-3 times depending on cell's editability. onEditCell event passes the following parameters:

  • stage - stage of editing (0-before start[can be canceled if returns false],1- the editor is opened,2- the editor is closed);
  • rId - id of the row;
  • cInd - index of the cell;
  • nValue - new value (only for the stage 2);
  • oValue - old value (only for the stage 2).
          grid.attachEvent("onEditCell", function(stage,rId,cInd,nValue,oValue){});

During normal edit process event fires 3 times

  • cell edition initiated ( stage = 0 )
  • cell editor activated and ready for input ( stage = 1 )
  • cell edition finished ( stage = 2 )

The 3rd call can cause different results based on returned value

  • {bool}true - confirm edit operation
  • {bool}false - deny edit operation ( previous cell value will be restored )
  • {string} or {number} - provided value will be used a new value of the cell instead of one entered by user

Event commonly used for validation