Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Larry Hamlet on Jan 02, 2009 15:48
open dhtmlx forum
Cell-To-Cell OnBlur Event Capture Within The Grid

In your sample page "Using Event Handlers to limit cell editor max length" you demonstrate the following code:

mygrid.attachEvent("onEditCell",function(stage,rowId,cInd){
if(cInd==1 && stage==1){
mygrid.editor.obj.onkeypress = function(e){
if(this.value.length>=20){
return false;
}
}
}
return true;
})

Of interest to me is the "onkeypress" event capture.

For post-entry validation I would like to capture the "onblur" event when moving from cell to cell within the Grid. The onblur event used as above only seems to fire when I leave the entire Grid.
In short, how can I capture an "onblur" event of the cell to any other cell while still within the Grid?

Also, is there a list somewhere of other valid events I may use in the scenario above?

Thank You,
Larry
Answer posted by Support on Jan 09, 2009 09:45
Technically, instead of adding any native DOM events you can use onEditCell directly.
onEditCell stage 2 fired when 
 - focus moved outside of grid
 - focus moved to any other cell in grid

so, technically it is perfect place for you validation

mygrid.attachEvent("onEditCell",function(stage,rowId,cInd,value){
      if (stage ==2){
              any custom code, for onblur action here
      }
      return true;
});
Answer posted by Support on Jan 09, 2009 09:48
>>Also, is there a list somewhere of other valid events I may use in the scenario above?
Technically you can use any events except of blur ( in most scenarios element will be fully removed from DOM without executing onblur )
Also, onclick event blocked by grid's native code , so redefining it may cause some side-effects.