Instead of using
tr class="collapse" id="collapseProduct0"
on the
tr
, it has been assigned to a new div which now wraps the
<div class="card card-body">... </div>
. To eliminate the padding left by bootstrap, a new class was introduced to ensure that when the row is collapsed, there is no visible padding.
The following code should help achieve the desired outcome...
.collapseContainingDiv td {
padding: 0 !important;
}
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<div class="card-body justify-content-center">
<p><a class="btn btn-primary collapsed" data-toggle="collapse" href="#collapseProduct" role="button" aria-expanded="false" aria-controls="collapseProduct">Animate div</a><button class="btn btn-primary collapsed" type="button" data-toggle="collapse" data-target="#collapseProduct0"
aria-expanded="false" aria-controls="collapseProduct0">Animate tr</button></p>
<div class="collapse" id="collapseProduct" style="">
<div class="card card-body">Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.</div>
</div>
<table class="table table-hover">
<tbody>
<tr>
<th>Name</th>
<th>Description</th>
<th>Product Group</th>
<th class="text-center">Taxable</th>
<th class="text-center">Tax Included</th>
<th></th>
</tr>
<tr>
<td>Bitwolf</td>
<td>Focused value-added access</td>
<td>Sepatu Futsal</td>
<td class="text-center"><i class="fa fa-times text-danger"></i></td>
<td class="text-center"><i class="fa fa-check text-info"></i></td>
<td>
<div class="btn-group" role="group" aria-label="Basic example"><button type="button" class="btn btn-outline-primary collapsed" data-toggle="collapse" data-target="#collapseProduct0" aria-expanded="false" aria-controls="collapseProduct0"><i
class="fa fa-pencil"></i></button><button type="button" class="btn btn-outline-danger" data-toggle="modal" data-target="#exampleModal"><i class="fa fa-trash"></i></button></div>
</td>
</tr>
<div class="collapseContainingDiv">
<td colspan="6">
<div class="collapse" id="collapseProduct0" style="">
<div class="card card-body">SECOND Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.</div>
</div>
</td>
</div>
...
</div>