Since: DataTables 1.10

Initialisation complete callback.


It can often be useful to know when your table has fully been initialised, data loaded and drawn, particularly 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.

Additionally the callback is passed in the JSON data received from the server when Ajax loading data, which can be useful for configuring components connected to your table, for example Editor fields.


function initComplete( settings, json )



Show an alert when the table has fully loaded:

$('#example').dataTable( {
  "initComplete": function(settings, json) {
    alert( 'DataTables has finished its initialisation.' );
} );

Show a loading message while the table is being initialised (processing will do this as well):

$('<div class="loading">Loading</div>').appendTo('body');

$('#example').dataTable( {
  "initComplete": function( settings, json ) {
} );


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