colReorder.order
Set a default order for the columns in the table.
Please note - this property requires the ColReorder extension for DataTables.
Description
This option provides the option to define a default order for the columns in a table. Typically you will wish to have the columns in the order defined in the HTML, or from state saving (stateSave
), but if required, this option can be used to define an initial default order.
Type
array
- Description:
An array of integer values that define the order the columns should appear in. The position in the array is the position the column will take, and the value is the current column index that should be shown in that new position.
The array must contain all columns in the table, and cannot contain duplicates.
Default
- Value:
null
The table's default column ordering will be used
Example
Enable ColReorder and reserve the table's default column order (for a six column table):
new DataTable('#myTable', {
colReorder: {
order: [5, 4, 3, 2, 1, 0]
}
});
Related
The following options are directly related and may also be useful in your application development.