DHTMLX Docs & Samples Explorer

Custom output with math calculations

As you could see in the previous sample, you are allowed to calculate cells values automatically by math formulas. Moreover you have a possibility to customize cells applying any custom cells types.


Source
<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxgrid.css">
<link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxgrid_dhx_skyblue.css">
<script  src="../../codebase/dhtmlxcommon.js"></script>
<script  src="../../codebase/dhtmlxgrid.js"></script>        
<script  src="../../codebase/dhtmlxgridcell.js"></script>
<script  src="../../codebase/ext/dhtmlxgrid_math.js"></script>
 
 
<div id="gridbox" style="width:510px;height:200px;background-color:white;"></div>
<br>
<script>
mygrid = new dhtmlXGridObject('gridbox');
mygrid.setImagePath("../../codebase/imgs/");
mygrid.setHeader("Book Title,Author,Price,Quantity,Total");
mygrid.setInitWidths("150,120,80,80,80");
mygrid.setColAlign("left,left,right,right,right");
mygrid.setColTypes("ed,ed,price,ed,price[=c2*c3]");
mygrid.setColSorting("str,str,int,int,int");
mygrid.setMathRound(2);
mygrid.init();
mygrid.setSkin("dhx_skyblue");
mygrid.loadXML("../common/grid_math2.xml");
</script>