Rhynel
1 month ago

How to close all when I click someone open?

Posted 1 month ago by Rhynel

// Add event listener for opening and closing details

$('#laravel_datatable 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');
            }

     });

Please sign in or create an account to participate in this conversation.