row in row datatable code example

Example 1: datatable get row data

var table = $('#example').DataTable();

$('#example tbody').on( 'click', 'tr', function () {
    console.log( table.row( this ).data() );
} );

Example 2: datatables on row created

$('#example').DataTable( {
  	createdRow: function ( row, data, index ) {
      	// row = tr node
      	// data = raw data (array or obj)
      	// index = The index of the row in DataTables' internal storage.
    	$(row).addClass('highlight');
  	}
} );

Example 3: get row data in datatable

Javascript12345var table = $('#example').DataTable(); $('#example tbody').on( 'click', 'tr', function () {    console.log( table.row( this ).data() );} );