This can be done using the DataTables ColReorder . After the plugin is enabled, columns can be moved using fnColReorder(from, to) as follows:
var table = jQuery("#table_id").dataTable(settings); table.fnColReorder(4, 10);
But when using column indexes, special attention should be paid: these are indexes from an array of table columns. This means that the index does not have to match the column number in the table (some columns may be hidden according to your specification).
source share