I am dynamically appending child rows to datatables in order to display data that is retrieved dynamically. Below is the code snippet illustrating this:
var oTable = $('#myTable5').DataTable();
var tr = $('#'+id).closest('tr');
var row = oTable.row( tr );
console.log(row);
if ( row.child.isShown() ) {
// This row is already open - close it
row.child.hide();
tr.removeClass('shown');
}
else {
// Open this row
row.child( format(dataSet) ).show();
tr.addClass('shown');
}
Despite multiple attempts, I have been unsuccessful in adding a background color to these child rows! Various approaches have failed to produce the desired outcome. If you have managed to accomplish this, please provide assistance. My inquiries on datatable forums have not yielded any effective solutions.
Thank you in advance.