autoFill().enable()

Since: AutoFill 2.2.0

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

Description

This method can be used to enable and disable the AutoFill end user interaction with a DataTable. In its simplest form it can be used to enable AutoFill, 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 AutoFill, the autoFill option must be specified in the DataTable initialisation. This method cannot be used to enable AutoFill if autoFill has not be used.

Type

function autoFill().enable( [ flag ] )

Description:

Enable end user and API modification of the focused cells in the DataTable. Differing levels of enablement are available via the optional parameter.

Parameters:
Returns:

DataTables API instance

Example

Toggle the enabled state of AutoFill on a button click:

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

$('#toggleAutoFill').on( 'click', function () {
	table.autoFill().enable(
		! table.autoFill().enabled()
	);
} );

Related

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