buttons disappearing from the parent table
buttons disappearing from the parent table
When expanding child record datatable from the parent table, the parent table buttons (Copy,Excel,Csv,Print) are disappearing
Here's my code
//parent table
var table=$('#datatable').DataTable({
"dom": 'lBtirp',
"ajax": { ...// code },
buttons: ['copyHtml5','excelHtml5','csvHtml5','print']
});
//child table
var subtable=$('table#'+subtable_id).DataTable({
"dom": 'ltirp',
"ajax": { ...// code },
...
});
// Add event listener for opening and closing details
$('#datatable tbody').on('click', 'td.details-control', function () {
tr = $(this).closest('tr');
var tdi = tr.find("i.fa");
row = table.row( tr );
if ( row.child.isShown() ) {
// This row is already open - close it
row.child.hide();
tr.removeClass('shown');
tdi.first().removeClass('fa-minus-square');
tdi.first().addClass('fa-plus-square');
}
else {
// Open this row
//row.child( format(row.data()) ).show();
request_id=row.data().request_id;
response_id=row.data().response_id;
var subtable_id = "subtable-"+request_id;
row.child(format(subtable_id)).show();
tr.addClass('shown');
sub_DataTable(subtable_id, tr);
tdi.first().removeClass('fa-plus-square');
tdi.first().addClass('fa-minus-square');
}
} );