Categories | Question details Back To List | ||
onCellChanged problem Hello, I am having a problem with the onCellChanged code. I have two version one of whoch doesn't work and the other wokrs incorrectly. I am following your examples and documentation but this doesn't seem to be working? We have the pro version. 1. This code does not work. It gives an error saying that ChildNodes is empty. /// mygrid.attachEvent("onCellChanged",function(stage,id,index,value){ var header=mygrid.getHeaderCol(index); if(header=="Name") { if (stage==2){ alert('testing ' + id + ' cellval ' + value); } } return true; }); /// 2., This code doesn't give an error but instead the following happens. The alert (where my fucntion will go eventually) pops up after editing the cell with the new text entered. Click OK and it pops up again with the original text. Basically it changes the cell then changes it back. Any ideas? mygrid.attachEvent("onCellChanged",function(id,index,value){ var header=mygrid.getHeaderCol(index); if(header=="Name") { alert('testing ' + id + ' cellval ' + value); } }); Answer posted by Support on Feb 07, 2008 09:07 >>This code does not work. It gives an error saying that ChildNodes is empty.
Original version of getHeaderCol may work incorrectly if you are using colspans in grid header (also it may occur in case of specific sking customization )- if it is a your case - please contact us directly at support@dhtmlx.com - I will send you an updated version of dhtmlxgrid. >>Basically it changes the cell then changes it back. Any ideas? Such behavior can't be triggered by onCellChanged event itself. Are you using onCellEdit event? if you have such event handler and it has not return true; at the end, it will be equal to blocking results of edit action, and as result value of cell will be reverted to original one. Answer posted by scott on Feb 08, 2008 03:15 Hello I have tried the following version of this code
mygrid.attachEvent("onEditCell",function(stage,id,index,value){ var header=mygrid.getHeaderCol(index); This stops the alert from coming up twice but once the editing is finished it still reverts to the original value. The getHeaderCol defintely works. Answer posted by scott on Feb 08, 2008 03:16 sorry that was the wrong code this is the code I am using
mygrid.attachEvent("onEditCell",function(stage,id,index,value){ var header=mygrid.getHeaderCol(index); Answer posted by Support on Feb 08, 2008 08:05 The same code works correctly in my local samples. If problem still occurs for you - please provide any kind of sample (you can send it directly to support@dhtmlx.com) where it can be reconstructed. |