1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
<?xml version="1.0" encoding="UTF-8" ?>
<dt-event>
<name>init</name>
<summary>Initialisation complete event - fired when DataTables has been fully initialised and data loaded.</summary>
<since>1.10</since>
<type type="function">
<signature>function( e, settings, json )</signature>
<parameter type="object" name="e">
jQuery event object
</parameter>
<parameter type="DataTables.Settings" name="settings">
DataTables settings object
</parameter>
<parameter type="object" name="json">
JSON data retrieved from the server, if Ajax loading data
</parameter>
<scope>HTML table element</scope>
</type>
<description>
The `dt-event init` event is the event complement of the `dt-init initComplete` initialisation option. Like the callback, the `dt-event init` event is called when your table has fully been initialised, data loaded and drawn, which can be particularly useful when using an `dt-init 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 `dt-event init` event is fired at the same point as `dt-init 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.
</description>
<example title="Show information about the current sort using the API"><![CDATA[
console.log( 'Table initialisation start: '+new Date().getTime() );
$('#example')
.on( 'init.dt', function () {
console.log( 'Table initialisation complete: '+new Date().getTime() );
} )
.dataTable();
]]></example>
<related>dt-init initComplete</related>
<related>dt-event preInit</related>
</dt-event>
|