JSFiddle - React, Tailwind, and code Playground
by DarKim
HTML
<script src="dt-1.10.15"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-mockjax/1.6.2/jquery.mockjax.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/v/dt/dt-1.10.15/datatables.min.css">
<script src="https://cdn.datatables.net/v/dt/dt-1.10.15/datatables.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.19/js/jquery.dataTables.min.js"></script>
<p>
<button type="button" id="btn-reload">Reload</button>
</p>
<div class="container">
<table id="example" class="display" cellspacing="0" width="400px">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Extn.</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Extn.</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</tfoot>
</table>
</div>
<script>
// FOR DEMONSTRATION ONLY: AJAX emulation
$.mockjax({
url: '/test/0',
responseTime: 1000,
response: function(settings){
console.log("Request data: ", settings.data);
this.responseText = {
data: [],
};
for(var i = 0; i < 100; i++){
this.responseText.data.push([
"A" + (i + 1),
"B" + (i + 1),
"C" + (i + 1),
"D" + (i + 1),
"E" + (i + 1),
"F" + (i + 1)
]);
}
}
});
</script>
CSS
.container {
width: 400px;
margin: 0 auto;
}