Getting total values of column entries across a row

Hi,





I am using dhtmlxgrid object…I need to get horizontal summation of values in the columns across a row. The first time i am editing a cell, the sum get updated.On second cell edit onwards, the horizontal summation doesnt work…can you please help me out?

You can use “in-grid-math”, which allows to achieve necessary effect
        mygrid.setColTypes(“ed,ed,ed,ed,ro[=c0+c1+c2+c3]”);

Sample of usage attached

>>n second cell edit onwards, the horizontal summation doesnt work
If problem still occurs for you - please send any kind of sample where problem can be reconstructed.

sample_math.zip (717 Bytes)


still that issue exist…so i am giving a sample of teh code



function loadGrid(){



mygrid.setHeader(“Grades,Comments,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec,Jan,Feb,Mar,Total”);
   mygrid.setInitWidths(“60,80,60,60,60,60,60,60,60,60,60,60,60,60,85”);
   mygrid.setColTypes(“ro,txt,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ro[=c2+c3+c4+c5+c6+c7+c8+c9+c10+c11+c12+c13]”);
   mygrid.setColAlign(“left,left,right,right,right,right,right,right,right,right,right,right,right,right,right”);
   mygrid.setColSorting(“str,str,int,int,int,int,int,int,int,int,int,int,int,int,int”);
   mygrid.setSkin(“modern”);
   mygrid.init();
   mygrid.setOnEditCellHandler(doOnCellEdit);
   mygrid.setOnKeyPressed(onKeyPressed);

   mygrid.enableBlockSelection();
   mygrid.attachFooter(“Total,#cspan,

0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
”,[“text-align:left;”])
   mygrid.loadXMLString(somexmlString,calculateFooterValues);



}



 



 



“somexmlString” gives the xml String for the grid

Please check attached sample , it uses you code snippet and works correctly.
Please be sure that doOnCellEdit function returns true, because any other result will block edit operation, and as result prevent total calculations.

1207300608.ZIP (1.07 KB)