Since: ColReorder 1.5.0

Enable or disable ColReorder's interactions.
Please note - this property requires the ColReorder extension for DataTables.


This method can be used to enable and disable the ColReorder end user interaction with a DataTable. In its simplest form it can be used to enable ColReorder, but it can also be used to disable it using the optional parameter. This is useful to be able to toggle the enablement state using a ternary operator or some external variable.

Please note that in order to be able to enable ColReorder, the colReorder option must be specified in the DataTable initialisation. This method cannot be used to enable ColReorder if colReorder has not be used.


function colReorder.enable( [ flag ] )


Enable and disable user ability to reorder columns in a table.


DataTables API instance


Enable / disable column reordering using buttons:

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

$('#enableReordering').on( 'click', function () {
	table.colReorder.enable( true );
} );

$('#disableReordering').on( 'click', function () {
	table.colReorder.enable( false );
} );


The following options are directly related and may also be useful in your application development.