{hero}

colReorder.columns

Select which columns can be reordered.
Please note - this property requires the ColReorder extension for DataTables.

Description

This option can be used to select which columns ColReorder will allow the end user to perform reordering on. Columns which are not selected cannot have column reordering started on them (i.e. can't click and drag a header for them), nor can another column that is being reordered be dropped in this column's position.

Locking columns in this way can be particularly useful if you have important information or controls at the start / end of a table that you want to always be in the same place.

Please note that this method does not have any impact on column reordering via the API (e.g. colReorder.move() and colReorder.order()). If you have your own UI layer for column reordering that uses those methods, you will need to implement any column reordering restrictions you might want to impose on the end user.

Please note that this option replaces the colReorder.fixedColumnsLeft and colReorder.fixedColumnsRight options from ColReorder 1.x.

Type

column-selector

Description:

Any column selector, including class names, CSS pseudo selectors and column indexes.

Default

  • Value:

Empty string - all columns can be reordered.

Example

Disable reordering for first two columns in the table:

new DataTable('#myTable', {
	colReorder: {
		columns: ':gt(1)'
	}
});