colReorder.transpose()

Since: ColReorder 1.3.0

Convert one or more column indexes to and from current and original indexes. Please note - this property requires the ColReorder extension for DataTables.

Description

ColReorder will change the indexes of columns when columns are reordered and it can often be useful to convert between the original column index and the current column index. This method provides that ability.

This ability to transpose between current and original values can be really useful if you have a reference to a column (column().index()) and you want to ensure that your index refers to the correct column, regardless of ordering.

For example consider column index 0 is moved by the end user to index 5. You need to find out what its index is - this method provides that ability.

Note that if ColReorder is not enabled on the target table this method can still be safely called - the input data will simply be returned (since no transposition is required).

Type

function colReorder.transpose( idx [, direction ] )

Description:

Get one or more current column indexes form their original index.

Parameters:
Returns:

The transpose values

Example

Get the current column position of the column that was in index 0 when the table was created:

var table = $('#example').DataTable( {
	colReorder: true
} );

$('#info').click( function (e) {
	alert( table.colReorder.transpose( 0 ) );
} );