footerCallback

Since: DataTables 1.10

Footer display callback function.

Description

Identical to headerCallback but for the table footer this function allows you to modify the table footer on every 'draw' event.

Note that if the table does not have a tfoot element, it this callback will not be fired.

Type

function footerCallback( tfoot, data, start, end, display )

Parameters:

Examples

Alter the content of the footer on callback:

$('#example').dataTable( {
  "footerCallback": function( tfoot, data, start, end, display ) {
    $(tfoot).find('th').eq(0).html( "Starting index is "+start );
  }
} );

Use the API to sum a specific column and output:

$('#example').dataTable( {
  "footerCallback": function( tfoot, data, start, end, display ) {
    var api = this.api();
    $( api.column( 5 ).footer() ).html(
    	api.column( 5 ).data().reduce( function ( a, b ) {
    		return a + b;
    	}, 0 )
    );
  }
} );

Related

The following options are directly related and may also be useful in your application development.