{hero}

colReorder.headerRows

Since: ColReorder 2.1.0

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

Description

If you have a header in your DataTable that spans multiple rows, you might wish to only have the event handler for ColReorder's click and drag action apply to a specific row in the header (e.g. if you use a second row for column search inputs). This option provides that ability by being able to specify which rows the click and drag listener should be applied to.

Type

array

An array of the header row indexes that should be considered for the ColReorder drag and drop action.

Default

  • Value: null

If null, then all header cells will received a click and drag listener (allowing for colReorder.columns).

Example

Apply click and drag listeners to only the first row in the table header:

new DataTable('#myTable', {
	colReorder: {
		headerRows: [0]
	}
});