using footercallback to calculate sumatory

using footercallback to calculate sumatory

santiagozkysantiagozky Posts: 8Questions: 0Answers: 0
edited October 2009 in General
Hello datatablerers,

I want to use the fnFooterCallback to calculate the sum of some columns in my tables. The problem is that the order the rows are being showed does not correspond to the order of the data in the array.

Here is part of my code:
[code]
"fnFooterCallback": function(nRow, aasData, iStart, iEnd, aiDisplay ) {

//delete the footers
$($(nRow).children()).remove();
//recreate the footers
for(var i=0;i

Replies

  • santiagozkysantiagozky Posts: 8Questions: 0Answers: 0
    Hello again,

    I just saw my error, I forgot to use aiDisplay as index for getting the data.

    I just changed
    [code] total=total+parseInt(aasData[i][3]);[/code]
    to
    [code] total=total+parseInt(aasData[aiDisplay[i]][3]);[/code]
This discussion has been closed.