Open one Row Details at a time Datatable?
<p>So,</p>

<p>There is this example <a href="https://datatables.net/examples/server_side/row_details.html" rel="nofollow">https://datatables.net/examples/server_side/row_details.html</a></p>

<p>How can only one row details is open at a time and if I click other the previous opened row details closes ?</p>

<p>Any suggestions ?</p>

<p>So here is my new code the row details that I am showing have two other format <strong>(case1,case2)</strong></p>

<pre><code>var tr = $(this).closest('tr');
var row = dt.row(tr);
var idx = $.inArray(tr.attr('id'), detailRows);

if (row.child.isShown()) {
    tr.removeClass('details');
    row.child.hide();

    // Remove from the 'open' array
    detailRows.splice(idx, 1);
} 
else {

    // Add to the 'open' array
    if (idx === -1) {
        detailRows.push(tr.attr('id'));
    }

    if (dt.cell('.details', 1).data() == "SIRE" || dt.cell('.details', 1).data() == "CDI" || dt.cell('.details', 1).data() == "Terminal" || dt.cell('.details', 1).data() == "Other") {
        row.child(case1(row.data())).show();
    }
    else {
        row.child(case2(row.data())).show();
    }
}
</code></pre>