{hero}

headerCallback

Since: DataTables 1.10

Header display callback function.

Description

This function is called on every 'draw' event (i.e. when a filter, sort or page event is initiated by the end user or the API), and allows you to dynamically modify the header row. This can be used to calculate and display useful information about the table.

Type

function headerCallback( thead, data, start, end, display )

Parameters:

Example

Show information about the records being displayed:

new DataTable('#myTable', {
	headerCallback: function (thead, data, start, end, display) {
		$(thead)
			.find('th')
			.eq(0)
			.html('Displaying ' + (end - start) + ' records');
	}
});

Related

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