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
colReorder.move( from, to [, drop [, invalidate ] ] )
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 | |||
4 | invalidate | Yes - default:true | |
Invalidate the row data. As with |
Returns:
DataTables.Api
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);