Accumulated Column Sum

Accumulated Column Sum

erickneerickne Posts: 3Questions: 0Answers: 0
edited December 2011 in General
Hello guys!

Is it possible so make an accumulated column? Like...

id | value | acc
1 | 10 | 10
2 | 2 | 12
3 | 5 | 17
4 | 20 | 37

I tried with fnrender... I need something like this:

[code]
"aoColumnDefs": [
{
"fnRender": function ( oObj ) {
Roww = oObj.iDataRow -1;
return oObj.aData[5] +' '+ oObj.aData[ Roww ][0];
},
"aTargets": [ 6 ]
}
],
[/code]

Replies

  • allanallan Posts: 63,538Questions: 1Answers: 10,476 Site admin
    The fnRender approach sounds fine to me. What aspect of it doesn't work? Do you not need to add multiple columns together?

    Allan
  • erickneerickne Posts: 3Questions: 0Answers: 0
    Everything I try does not work. I think is fnRender but it's not working.

    How do I get the row above ?

    I thought oObj.aData[i-1][5] would work...
  • allanallan Posts: 63,538Questions: 1Answers: 10,476 Site admin
    oObj.aData in the above code is a 1D array - so [i-1][5] isn't going to work. oObj.aData is the array that makes up the data for that row - so oObj.aData[1] + oObj.aData[2] is the sum of the second and third columns (etc).

    Allan
  • erickneerickne Posts: 3Questions: 0Answers: 0
    Yeah, I got that... But is there a way to get the array from the row above or below??
This discussion has been closed.