How to get the datatable or the filtered data from within fnFooterCallback?

How to get the datatable or the filtered data from within fnFooterCallback?

robertbrowerrobertbrower Posts: 158Questions: 1Answers: 0
edited September 2013 in General
I'm using fnFooterCallback to calculate min, max, average, etc. and showing that info in the tfoot->tr>th.

This works well when using aaData that gets passed into the function. But I want to show this info for just the filtered rows.

How to get the datatable or the filtered data from within fnFooterCallback?

Thanks!

Robert

Replies

  • robertbrowerrobertbrower Posts: 158Questions: 1Answers: 0
    The solution is to get the datatable like this:

    , "fnFooterCallback": function (nRow, aaData, iStart, iEnd, aiDisplay) {
    aaData = settings.$timelineTable.dataTable()._('tr', { "filter": "applied" }) // get the filtered data
    .
    .
    .
    }

    See also: http://datatables.net/forums/discussion/2053/fnfootercallback-sum-column-after-filter/p1
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    You can just use `this._( ... )` . All the DataTables callbacks are executed in the scope of the DataTable.

    Allan
This discussion has been closed.