row().child show on load
row().child show on load
This is probably quite simple, however I cannot get it to work. I want my child rows to show by default when the table loads. I am using the following function to control the display of the child when an icon is clicked on the appropriate row:
$('#cms_module_uptime_monitors tbody').on('click', 'td.details-control', function () {
var tr = $(this).closest('tr');
var row = table.row( tr );
if ( row.child.isShown() ) {
// This row is already open - close it
row.child.hide();
tr.removeClass('shown');
}
else {
// Open this row
row.child( format(row.data()) ).show();
tr.addClass('shown');
}
});
However, I would like the default state to be open and not closed.
Is this possible? I have manually tried to add the class 'shown' but it doesn't look like datatables has loaded the information yet, I guess that happens when the button is clicked?
This question has an accepted answers - jump to answer
Answers
Two options:
row().child().show()
method after the initialisationFor 1, all you would do is:
Allan
Thanks