Math formula

Hi, i’m using a treegrid and i use =sum in some columns…everything works perfect, but i need another row at the end of the grid that makes the summatory of the other rows. How can i do this??



Thanks in advance.

The best solution will be add a footer which will be always visible
To calculate total next code can be used

grid.attachEvent(“onMathEnd”,function(){
    //code called after each math excell finished calculation
    var total=0;
    var childs=grid.getAllSubItems(0).split(",");
    for (var i=0; i<childs.length; i++)
       total+=grid.cells(childs[i],INDEX).getValue();   //INDEX - index of necessary column
    //here you have total value and can set it to footer or to any special row
});


Hi, thanks for your reply, i tried to use onMathEnd event with no success, i have the dhtmlxTreeGrid_v14_Pro_70813 version. Right now i’m using onXLE event but as you probably expected i’m having troubles with the columns with math formulas, i’m gettinh NaN as total. Please help me.



Thanks.

Please contact us directly at support@dhtmlx.com - I will provide you latest version of _math extension, which will support mentioned event (onMathEnd)  - there is no support for it in dhtmlxTreeGrid_v14_Pro_70813 it was introduced in dhtmlxTreeGrid_pro_v14_71022