childRow

Since: DataTables 1.11

A child row has been added or removed from the table.

Description

The childRow is triggered whenever a child row is inserted or removed from the table.

Please note that, as with all DataTables emitted events, the event object has a DataTables API instance available on it in the dt property.

Type

function( e, show, row )

Parameters:

Example

Notification on child row display change:

let table = new DataTable('#myTable', {
	ajax: '../ajax/data/objects.txt',
	rowId: 'id',
	stateSave: true,
	columns: [
		{
			className: 'dt-control',
			orderable: false,
			data: null,
			defaultContent: ''
		},
		{ data: 'name' },
		{ data: 'position' },
		{ data: 'office' },
		{ data: 'salary' }
	],
	order: [[1, 'asc']]
});

table.on('childRow', function (e, show, row) {
	console.log((show ? 'Showing ' : 'Hiding ') + 'row ' + row.index());
});