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, index )

Parameters:

Examples

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

$('#example').dataTable( {
  "rowCallback": function( row, data, index ) {
    if ( data.grade == "A" ) {
      $('td:eq(4)', row).html( '<b>A</b>' );
    }
  }
} );

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

$('#example').dataTable( {
  "rowCallback": function( row, data, index ) {
    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.