{hero}

rowReorder.dataSrc

Configure the data point that will be used for the reordering data.
Please note - this property requires the RowReorder extension for DataTables.

Description

When rows are reordered, RowReorder will automatically adjust the data in the DataTable to reflect the change made by the reordering. This option tells RowReorder what data property in the data source object / array for each row (see row().data()) should be read and set.

Typically this option will be used to point to a column with a sequence number that defines an order. However, this need not be the case - any property in the data source object can be used, even one that is not used in a DataTables column.

Types

integer

Description:

Array index for when DataTables stores row data in arrays. Use this option if you do not set columns.data for your column.

object

Description:

Object property for when DataTables stores row data in objects. Use this option if you do set columns.data for your column. Like columns.data this option can be used with nested JSON data using dotted Javascript notation - this can be particularly useful for working with tables where the data is sourced from joined SQL tables.

Default

  • Value: 0

Array index 0.

Examples

Enable RowReorder and set the dataSrc to the object property sequence:

new DataTable('#myTable', {
	rowReorder: {
		dataSrc: 'sequence'
	}
});

Use nested data with a data source:

new DataTable('#myTable', {
	rowReorder: {
		dataSrc: 'race.order'
	}
});