{hero}

init

Since: DataTables 1.10

Initialisation complete event - fired when DataTables has been fully initialised and data loaded.

Description

The init event is the event compliment of the initComplete initialisation option. Like the callback, the init event is called when your table has fully been initialised, data loaded and drawn, which can be particularly useful when using an ajax data source. In such a case, the table will complete its initial run before the data has been loaded (Ajax is asynchronous after all!) so this callback is provided to let you know when the data is fully loaded.

The init event is fired at the same point as initComplete (technically the callback fires before the event, but they occur sequentially and thus either can be used to achieve the same effect).

Please note that, as with all DataTables emitted events, this event is triggered with the dt namespace. As such, to listen for this event, you must also use the dt namespace by simply appending .dt to your event name, as shown in the example below.

Type

function function( e, settings, json )

Parameters:

Example

Show information about the current sort using the API:

console.log( 'Table initialisation start: '+new Date().getTime() );

$('#example')
	.on( 'init.dt', function () {
		console.log( 'Table initialisation complete: '+new Date().getTime() );
	} )
	.dataTable();

Related

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