JSFiddle - React, Tailwind, and code Playground
by Joe Hyink
HTML
<link rel="stylesheet" href="https://cdn.datatables.net/v/ju/dt-1.10.12/cr-1.3.2/datatables.min.css">
<script src="https://cdn.datatables.net/v/ju/dt-1.10.12/cr-1.3.2/datatables.min.js"></script>
<input id="test" type="hidden" value="2,1,0" />
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
</tr>
</tfoot>
<tbody>
<tr>
<td>Tiger Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
</tr>
<tr>
<td>Garrett Winters</td>
<td>Accountant</td>
<td>Tokyo</td>
</tr>
</tbody>
</table>
JavaScript
var colOrder = new Array($('#test').val().split(","));
$(document).ready(function() {
dataTable = $('#example').DataTable( {
colReorder: true
} );
dataTable.colReorder.order(colOrder);
} );