-
-
Notifications
You must be signed in to change notification settings - Fork 440
Expand file tree
/
Copy pathrequestChild.xml
More file actions
54 lines (45 loc) · 1.87 KB
/
Copy pathrequestChild.xml
File metadata and controls
54 lines (45 loc) · 1.87 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
45
46
47
48
49
50
51
52
53
54
<?xml version="1.0" encoding="UTF-8" ?>
<dt-event>
<name>requestChild</name>
<summary>DataTables wants to display a child row</summary>
<since>1.11</since>
<type type="function">
<signature>function( e, row )</signature>
<parameter type="object" name="e">
Event object
</parameter>
<parameter type="DataTables Api" name="row">
The parent row instance that the child row is attempting to display.
</parameter>
<scope>HTML table element</scope>
<bubbles>No</bubbles>
</type>
<description>
When `-init stateSave` is active, the `-event requestChild` is triggered when DataTables wants to insert a child row into the table. In this case, a listener has to be set that will implement the insertion of the child row. DataTables cannot handle this as it does not know how to present the data to the user. If no implementation is provided then child rows will not integrate with `-init stateSave`.
The function is passed the row that is being requested to show the child row. In order to identify the correct row, row ids must be set for 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. The listener must also be set before the table initialisation, otherwise when a state is attempting to load, the functionality to do so will not be available.
</description>
<example title="Notification of child row display request"><![CDATA[
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('requestChild', function (e, row) {
row.child(format(row.data())).show();
});
]]></example>
</dt-event>