Is it possible to nest a Datatable inside another dataTable as each parent row is rendered ?
Is it possible to nest a Datatable inside another dataTable as each parent row is rendered ?
Hello,
I am trying to nest a dataTable inside another dataTable and i want the child dataTable data, full of related records, to be looked-up and loaded as the parent is generated. I tried with createdRow but it does not seems to work. I can, however, call the function after the parent is drawn and it works.
parent : event in an area
child : related events in the same area that people must see for route planning.
Inside my parent dataTable call :
table = $(tableName).DataTable({ :
(...)
createdRow: function (row, data, dataIndex) {
if (data.related_events > 1) {
var tRow = table.row(':eq(' + dataIndex + ')');
var childName = 'detailsTable-' + data.id_evenement;
var detailsTableHtml = $("#detailsTable").html(); // a template
tRow.child(
formatChildTable(data.id_evenement, childName, detailsTableHtml)
).show();
loadRelatedTable(childName, data.id_evenement, p_destroy); // generates another DataTable for the related records (ex: more events for the same day inside the area (from the parent row))
}
(...)
Is there a way to do this that i am not aware of ?
Thank you