{hero}

rowCallback

Since: DataTables 1.10

Row draw callback.

Description

This callback allows you to 'post process' each row after it have been generated for each table draw, but before it is rendered into the document. This means that the contents of the row might not have dimensions ($().width() for example) if it is not already in the document.

This function might be used for setting the row class name or otherwise manipulating the row's tr element (although note that createdRow can often be more efficient).

Type

function rowCallback( row, data, displayNum, displayIndex, dataIndex )

Parameters:

Examples

Highlight cells based on their content (object data source):

new DataTable('#myTable', {
	rowCallback: function (row, data) {
		if (data.grade == 'A') {
			$('td:eq(4)', row).html('<b>A</b>');
		}
	}
});

Highlight cells based on their content (array data source):

new DataTable('#myTable', {
	rowCallback: function (row, data) {
		if (data[4] == 'A') {
			$('td:eq(4)', row).html('<b>A</b>');
		}
	}
});

Related

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