JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="https://unpkg.com/tabulator-tables@4.4.3/dist/css/tabulator.min.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js"></script>
<script src="https://unpkg.com/tabulator-tables@4.4.3/dist/js/tabulator.js"></script>
<h4>
Always visible table:
</h4>
<div id="always-shown" class="tabulator-table"></div>
<h4 class="mt-3">
Table initially hidden in the tabulator tab:
</h4>
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" id="tabulator-tab" data-toggle="tab" href="#tabulator" role="tab">Tabulator</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane show active" id="home" role="tabpanel">
Bacon ipsum dolor amet leberkas prosciutto pork loin pastrami jowl strip steak shoulder. Hamburger
tenderloin filet mignon kevin, biltong doner ribeye meatloaf capicola. Jerky kevin bresaola tongue
jowl shankle ball tip. Corned beef bacon capicola, cupim strip steak beef pork belly cow spare ribs
pork loin prosciutto t-bone burgdoggen chuck pig. Landjaeger burgdoggen bacon, tail kielbasa pig
porchetta alcatra filet mignon shank.
</div>
<div class="tab-pane" id="tabulator" role="tabpanel">
<div id="initially-hidden" class="tabulator-table"></div>
</div>
</div>
CSS
.tabulator-table {
width: 100%;
height: 200px;
}
JavaScript
var data = [
{ name: '1', description: 'Description of thing 1', location: 'Location 1', created_by: 'Joe Smith' },
{ name: '2', description: 'Description of thing 2', location: 'Location 2' },
{ name: '3', description: 'Description of thing 3', location: 'Location 3' },
];
var cols = [
{ field: 'name', title: 'Name', width: '20%' },
{ field: 'description', title: 'Description', width: '30%' },
{ field: 'location', title: 'Location', widthGrow: 2 },
];
var config = {
columns: cols,
data: data,
layout: 'fitColumns'
};
var always_shown_table = new Tabulator("#always-shown", config);
var initially_hidden_table = new Tabulator("#initially-hidden", config);
$("a[data-toggle='tab']").on('shown.bs.tab', function (e) {
if (e.target.id === 'tabulator-tab') {
console.log('redrawing table');
initially_hidden_table.redraw(true);
}
})