Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Alfonso Ortiz on Feb 26, 2009 08:28
open dhtmlx forum
onEditCell event overrides onCheck event

I am using checkboxes and normal text cells on my grid.
First I tested checkboxes with mygrid.attachEvent("onCheckbox",doOnCheck); and checkboxes worked fine.
Then I tested text edit cells with mygrid.attachEvent("onEditCell",doOnCellEdit); and edit mode worked fine.
But when I try to test the checkboxes again I got no answer from my doOnCheck function. Instead, I got answer from doOnCellEdit function. I know that because I got answer from doOnCellEdit on stage 0, but got no value of whether is checked or not.

If I comment the line mygrid.attachEvent("onEditCell",doOnCellEdit); everything works fine again with my checkboxes...
I understand that checkboxes are also liked with that event, but why is this happening?

Thanks in advance!
Answer posted by dhxSupport on Feb 26, 2009 09:14

Please if your doOnEditCell function returns true:

function doOnEditCell(stage, rowId,cellInd,newVal,oldVal){
  if (stage==0){
  alert("stage=0");
  }
  if (stage==1){
  alert("stage=1");
 
  }
  return true;
 }

Answer posted by Alfonso Ortiz on Feb 26, 2009 10:05
Excellent!

My doOnCellEdit did not return true.
After added that line now I got answer from doOnCheck function.

That means that you must return true for every function that is used by event handlers?

Excellent Job!!! Thank you!!!
Answer posted by Support on Feb 26, 2009 15:19
>>That means that you must return true for every function that is used by event handlers?
http://dhtmlx.com/docs/products/dhtmlxGrid/doc/events.html#grid_api_ev
All events placed in "before" column - blockable, not returning true from event handler will block default action related to event.
Answer posted by Alfonso Ortiz on Feb 26, 2009 15:34
Right, that makes some sense...

Thanks for pointing me in the right direction.