Footer Callback

Footer Callback

estudiosestudios Posts: 52Questions: 0Answers: 0
edited September 2013 in General
I am trying to lear how to use a footer callbak, I did use the same code showed in the example but I came up with NaN it seems that aaData is empty ,

The code is:

"sDom": "Tflrtip",
"aoColumns": [
{"mData": "fecha"},
{"mData": "idstaff"},
{"mData": "staff.nombre", "sDefaultContent": " "},
{"mData": "idproyecto"},
{"mData": "proyectos.codigoee", "sDefaultContent": " "},
{"mData": "cantidad"}
],

"fnFooterCallback": function ( nRow, aaData, iStart, iEnd, aiDisplay ) {

var iTotalhh = 0;
for ( var i=0 ; i

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I'd suggest console.log-ing out whatever is in `aaData[i][5]` in the loop. It sounds like there will be some non-numeric data in it.

    Allan
  • estudiosestudios Posts: 52Questions: 0Answers: 0
    Done,

    I have to use aaData[1]['cantidad'] instead of aaData[1][5].....I could not use number as index...do not know why.

    On the other hand the calculation of the "total" including the rows outside the pagination does not work.

    Is that happening because the server side?? can I solve it??
  • estudiosestudios Posts: 52Questions: 0Answers: 0
    more information aaData.lenght = 10 (equal to rows in page)
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Sounds like you are using objects as the data source not arrays, so array indexing wouldn't work.

    > Is that happening because the server side??

    If you are using server-side processing, then yes. The full data set is not available at the client-side, so of course it cannot calculate the full total. If you want the full total, you need to have the server calculate it.

    Allan
This discussion has been closed.