{hero}

column().footer()

Since: DataTables 1.10

Get the footer node for the selected column.

Description

This method can be used to obtain (and therefore modify) the footer cell for a column. This may be a th or td element depending on the HTML for your table.

The cell returned is the cell from the first row in the table tfoot element relating to the selected column. If you have multiple rows in the footer that you wish to manipulate you must use the table().footer() method to obtain the table footer element and then use standard DOM / jQuery methods to manipulate the node.

Furthermore, the cells in the tfoot may span multiple columns using colspan (they can also use rowspan, but again, only the cells in the first row will be available using this method). As such, a cell which uses colspan may belong to multiple columns.

Table footers are optional in DataTables. If the table for the column in the result set does not have a footer tag, null will be returned as the result.

Note that if the selector used in column() matches more than one column, the result set will be truncated to a single column - the first one in the result set.

Type

function column().footer( [row] )

Description:

Get the footer th / td cell for the selected column.

Parameters:
Returns:

Footer cell node for the selected element or null if the matched column does not have a footer cell.

Example

Sum column 0 and insert the resulting value into its footer:

var table = new DataTable('#myTable');
var column = table.column(0);

$(column.footer()).html(
	column.data().reduce(function (a, b) {
		return a + b;
	})
);

Related

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