"Bootstrap Tabs with Table"
Bootstrap 4.1.1 Snippet by kshiti06

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <section id="tabs" class="project-tab"> <div class="container"> <div class="row"> <div class="col-md-12"> <nav> <div class="nav nav-tabs nav-fill" id="nav-tab" role="tablist"> <a class="nav-item nav-link active" id="nav-home-tab" data-toggle="tab" href="#nav-home" role="tab" aria-controls="nav-home" aria-selected="true">Project Tab 1</a> <a class="nav-item nav-link" id="nav-profile-tab" data-toggle="tab" href="#nav-profile" role="tab" aria-controls="nav-profile" aria-selected="false">Project Tab 2</a> <a class="nav-item nav-link" id="nav-contact-tab" data-toggle="tab" href="#nav-contact" role="tab" aria-controls="nav-contact" aria-selected="false">Project Tab 3</a> </div> </nav> <div class="tab-content" id="nav-tabContent"> <div class="tab-pane fade show active" id="nav-home" role="tabpanel" aria-labelledby="nav-home-tab"> <table class="table" cellspacing="0"> <thead> <tr> <th>Project Name</th> <th>Employer</th> <th>Awards</th> </tr> </thead> <tbody> <tr> <td><a href="#">Work 1</a></td> <td>Doe</td> <td>john@example.com</td> </tr> <tr> <td><a href="#">Work 2</a></td> <td>Moe</td> <td>mary@example.com</td> </tr> <tr> <td><a href="#">Work 3</a></td> <td>Dooley</td> <td>july@example.com</td> </tr> </tbody> </table> </div> <div class="tab-pane fade" id="nav-profile" role="tabpanel" aria-labelledby="nav-profile-tab"> <table class="table" cellspacing="0"> <thead> <tr> <th>Project Name</th> <th>Employer</th> <th>Time</th> </tr> </thead> <tbody> <tr> <td><a href="#">Work 1</a></td> <td>Doe</td> <td>john@example.com</td> </tr> <tr> <td><a href="#">Work 2</a></td> <td>Moe</td> <td>mary@example.com</td> </tr> <tr> <td><a href="#">Work 3</a></td> <td>Dooley</td> <td>july@example.com</td> </tr> </tbody> </table> </div> <div class="tab-pane fade" id="nav-contact" role="tabpanel" aria-labelledby="nav-contact-tab"> <table class="table" cellspacing="0"> <thead> <tr> <th>Contest Name</th> <th>Date</th> <th>Award Position</th> </tr> </thead> <tbody> <tr> <td><a href="#">Work 1</a></td> <td>Doe</td> <td>john@example.com</td> </tr> <tr> <td><a href="#">Work 2</a></td> <td>Moe</td> <td>mary@example.com</td> </tr> <tr> <td><a href="#">Work 3</a></td> <td>Dooley</td> <td>july@example.com</td> </tr> </tbody> </table> </div> </div> </div> </div> </div> </section>
.project-tab { padding: 10%; margin-top: -8%; } .project-tab #tabs{ background: #007b5e; color: #eee; } .project-tab #tabs h6.section-title{ color: #eee; } .project-tab #tabs .nav-tabs .nav-item.show .nav-link, .nav-tabs .nav-link.active { color: #0062cc; background-color: transparent; border-color: transparent transparent #f3f3f3; border-bottom: 3px solid !important; font-size: 16px; font-weight: bold; } .project-tab .nav-link { border: 1px solid transparent; border-top-left-radius: .25rem; border-top-right-radius: .25rem; color: #0062cc; font-size: 16px; font-weight: 600; } .project-tab .nav-link:hover { border: none; } .project-tab thead{ background: #f3f3f3; color: #333; } .project-tab a{ text-decoration: none; color: #333; font-weight: 600; }

Related: See More


Questions / Comments:

I have find the solution.

Include Bootstrap library after jQuery library

Include Responsive extension version 1.0.1 or later

Use the code below:

$(document).ready( function () {

$('#myTable').DataTable( {

responsive: true,

"lengthMenu": [[8, 15, 30, -1], [8, 15, 30, "All"]]

});

$('#assigned').DataTable( {

responsive: true,

"lengthMenu": [[8, 15, 30, -1], [8, 15, 30, "All"]]

});

$('#closed').DataTable( {

responsive: true,

"lengthMenu": [[8, 15, 30, -1], [8, 15, 30, "All"]]

});

$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {

$($.fn.dataTable.tables(true)).DataTable()

.columns.adjust()

.responsive.recalc();

});

});

ImadUllah (0) - 5 years ago - Reply -1


The solution is to change the bootstap/jquery libraries with the new ones given on the website.

currently :

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>

<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>

aniaznk () - 5 years ago - Reply 0


change to

.project-tab .nav-link:hover {

border-color: transparent;

}

16pxdesign () - 5 years ago - Reply 0


.project-tab .nav-link:hover {

border: none;

}

16pxdesign () - 5 years ago - Reply 0


data-table just working on first tab and not working on other tabs...

ImadUllah (0) - 5 years ago - Reply 0


Hello, I would like to know which bootstrap version are you using.

kshiti06 (4) - 5 years ago - Reply 0