DHTMLX Docs & Samples Explorer

Math calculations

Calculate sum of children values automaticaly with [=sum]


Source
    
<link rel="STYLESHEET" type="text/css" href="../../../dhtmlxGrid/codebase/dhtmlxgrid.css">
<link rel="stylesheet" type="text/css" href="../../../dhtmlxGrid/codebase/skins/dhtmlxgrid_dhx_skyblue.css">
<script  src="../../../dhtmlxGrid/codebase/dhtmlxcommon.js"></script>
<script  src="../../../dhtmlxGrid/codebase/dhtmlxgrid.js"></script>
<script  src="../../../dhtmlxGrid/codebase/dhtmlxgridcell.js"></script>
<script  src="../../codebase/dhtmlxtreegrid.js"></script>
<script  src="../../../dhtmlxGrid/codebase/ext/dhtmlxgrid_math.js"></script>
            <div id="gridbox" width="519px" height="220px" style="background-color:white;"></div>
<br>
 
<script>
mygrid = new dhtmlXGridObject('gridbox');
mygrid.imgURL = "../../../dhtmlxGrid/codebase/imgs/icons_books/";
mygrid.setHeader("Title,Price,Quantity,Total");
mygrid.setInitWidths("*,70,120,120");
mygrid.setColAlign("left,right,right,right");
mygrid.setColTypes("tree,price,ed[=sum],price[=sum]");
mygrid.setColSorting("str,int,int,int");
mygrid.setMathRound(2);
mygrid.init();
mygrid.setSkin("dhx_skyblue");
mygrid.loadXML("../common/grid_math3.xml");
</script>