[=sum] problems on some columns

Dear Sir/Madam,

I have a treegrid. One of the fields is a budget field with the type int.

If a row has children, this budget field has a sum of his children. All this works fine.

The problem starts when I am dragging and dropping. When I drop a row(let’s call this r1) on another row(r2), I check if r2 had children before the row dropped.

If r2 is a new parent his type should change into [=sum]. In theory everything works fine, but on occasions the budget field of r2 will become; [=sum], although it follows exactly the same path in the debugger…

How can I fix this?

Thanks in advance,

Dennis Pullens


function drop_f(r1,r2){

//if the row is dragged on the same level as the top level row, it should cancel.

if(r2 == null || r2 == ‘undefined’){

var projectNr = Request(“ProjectNr”);

alert(‘De pagina wordt herladen, sorry voor het ongemak.’);


return false;


//the top level row may not be dragged

if(r1 == 1 || r1 == null){

alert(‘Je mag het project niet verslepen’);

return false;



//update the database without refreshing the page using an ajax-sack

ajax.requestFile = “updateDetailplanning.aspx?action=drop&ProjectNr=”+Request(“ProjectNr”)+"&r1="+r1+"&r2="+r2;

ajax.method = “POST”;

ajax.onCompletion = nothing;


//give the new parent a color and disable the budgetfield



//if the parent wasn’t a parent before

var childArr = mygrid.getSubItems(r2).split(",");

if(childArr.length < 2){




//if the dropped row has childs, the rowcolors and types change, this will set them right again




childArr = mygrid.getAllSubItems(r1).split(",");

var i;

for(i = 0; i < childArr.length; i++)











//if the dropped row doesn’t have childs, the row should be editable.





//if the parent of the dropped row has no childs after the drop, make it editable and white

if(parentIdDrop != null){










//check the icons on the first row



//expand the new parent of the dropped row




Which version of grid you are using?
There is known issues with complex math in case of dhtmlxgrid 1.6, which was fixed in version 2.0 ( you can contact us for related updated at support@dhtmlx.com )

In your code snippet, all code paths, which set =sum value commented, is it correct?
You are changing type of cell to the “ed”, when need to make it normal, but to change it bath to autocalculated, setting =sum is not enough, you need to use
mygrid.setCellExcellType(some,some,“math”); //necessary to switch back from ed

I am using version 1.6 with the version 2.0 editions of the files
- dhtmlxgrid
- dhtmlxcommon
- dhtmlxgridcell
- dhtmlxgrid_math

I also tested it in version 2.0 which gave the same problem.

the ‘mygrid.setCellExcellType(some,some,“math”);’ solution didn’t help.
I think the problem lies in the refreshing of the =sum-cell when a table is dragged or added underneath a cell which isn’t a parent yet.

More ideas ?

Best Regards,

Dennis Pullens

If cell in question has a “math” type it must treate the =sum as math formula, so for items without sub-items it will result in empty value.
If the cell has not “math” type , the value which you set will be rendered as is "=sum"

Then cell changed in math column, for which “=sum” was defined, it will trigger data update for whole column , but grid must update only cells with math value and skip other types.

If issues still occurs - please provide any kind of sample or link to the demo page, where issue can be reconstructed. ( you can send such info directly to support@dhtmlx.com )