colReorder.move()
Programmatically move columns.
Please note - this property requires the ColReorder extension for DataTables.
Description
This method provides the ability to programmatically change the order of one column at a time (while colReorder.order()
will set the order of all columns together).
Type
function colReorder.move( from, to [, drop [, invalidate ] ] )
- Description:
Programmatically reorder columns
- Parameters:
Name Type Optional 1 from
No Column index to move.
2 to
No New index to move the column to.
3 drop
Yes - default:true Indicate that this is the final move. Set this to
false
if you are performing multiple moves.4 invalidate
Yes - default:true Invalidate the row data. As with
drop
it can be useful to set this tofalse
if performing multiple moves. Otherwise allow it to default which will ensure that the table's data is fully insync with the column order.- Returns:
Unmodified API instance.
Example
Move the first column in the table to the second position:
var table = new DataTable('#myTable', {
colReorder: true
});
table.colReorder.move(0, 1);