JSFiddle - React, Tailwind, and code Playground
by nickkkk
HTML
<script src="https://cdn.datatables.net/1.10.2/js/jquery.dataTables.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.2/css/jquery.dataTables.css">
<script src="//cdn.datatables.net/plug-ins/1.10.19/sorting/absolute.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.4/moment.min.js"></script>
<script src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tbody>
<tr>
<td>Tiger Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>200</td>
<td></td>
<td>$320,800</td>
</tr>
<tr>
<td>Garrett Winters</td>
<td>Accountant</td>
<td>Tokyo</td>
<td></td>
<td>31.05.18</td>
<td>$170,750</td>
</tr>
<tr>
<td>Ashton Cox</td>
<td>Junior Technical Author</td>
<td>San Francisco</td>
<td>50</td>
<td>31.05.18</td>
<td>$86,000</td>
</tr>
<tr>
<td>Cedric Kelly</td>
<td>Senior Javascript Developer</td>
<td>Edinburgh</td>
<td>40</td>
<td>27.09.18</td>
<td>$433,060</td>
</tr>
<tr>
<td></td>
<td>Junior Technical Author</td>
<td>San Francisco</td>
<td>30</td>
<td>25.08.16</td>
<td>$86,000</td>
</tr>
<tr>
<td></td>
<td>Senior Javascript Developer</td>
<td>Edinburgh</td>
<td>20</td>
<td>23.08.18</td>
...
JavaScript
var namesType = $.fn.dataTable.absoluteOrder( [
{ value: '', position: 'bottom' }
] );
var numbersType = $.fn.dataTable.absoluteOrderNumber( [
{ value: '', position: 'bottom' }
] );
$(document).ready(function() {
$.fn.dataTable.moment('DD.MM.YY');
$('#example').dataTable({
columnDefs: [
{ type: namesType, targets: [0,4] },
{ type: numbersType, targets: [3,5] }
]
});
});