JSFiddle - React, Tailwind, and code Playground
by Muhammad Mushtaq Sheikh
HTML
<link rel="stylesheet" href="http://cdn.datatables.net/1.10.2/css/jquery.dataTables.min.css">
<script src="http://cdn.datatables.net/1.10.2/js/jquery.dataTables.min.js"></script>
<button id="lastpage">Add Row</button>
<table id="example" class="display" cellspacing="0" width="100%">
<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>
JavaScript
var url = "http://www.json-generator.com/api/json/get/bWIUWNtazS?indent=2";
$(document).ready(function () {
var table = $('#example').DataTable({
"ajax": url,
"order": [
[0, 'asc']
]
});
$('#lastpage').on('click', function () {
table.page('last').draw(false);
var row = ['testing12','testing','testing','testing','testing','testing'];
table.row.add(row).draw(false);
//table.order([1, 'asc']).draw();
});
});