-
-
Notifications
You must be signed in to change notification settings - Fork 440
Expand file tree
/
Copy pathdestroy.xml
More file actions
44 lines (34 loc) · 1.67 KB
/
Copy pathdestroy.xml
File metadata and controls
44 lines (34 loc) · 1.67 KB
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
42
43
44
<?xml version="1.0" encoding="UTF-8" ?>
<dt-event>
<name>destroy</name>
<summary>Table destroy event - fired when a table is destroyed.</summary>
<since>1.10</since>
<type type="function">
<signature>function( e, settings )</signature>
<parameter type="object" name="e">
Event object
</parameter>
<parameter type="DataTable.Context" name="settings">
DataTables settings object
</parameter>
<scope>HTML table element</scope>
<bubbles>Yes</bubbles>
</type>
<description>
The `-event destroy` event is fired when a DataTable is torn down, to be replaced with an enhanced HTML table (or simply removed from the DOM altogether). This can be used to remove bound events, added DOM nodes etc and can be particularly useful for plug-in authors.
This event is fired when the DataTable is destroyed by calling `-api destroy` API method or passing the `-init destroy` parameter in the initialisation object.
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.
This event will bubble up the document, so you can add a listener for `destroy.dt` to the `-tag body` to capture all destroy events triggered by DataTables.
</description>
<example title="Remove bound events on table destroy"><![CDATA[
let table = new DataTable('#myTable');
table.on('click', 'td', function () {
alert(this.innerHTML);
});
table.on('destroy', function (e, settings) {
table.off('click', 'td');
});
]]></example>
<related>-init destroy</related>
<related>-api destroy()</related>
</dt-event>