{hero}

button().processing()

Since: Buttons 1.3.0

Get / set the processing state for a button.
Please note - this property requires the Buttons extension for DataTables.

Description

Some actions that can be triggered by a button click can take a noticeable amount of time to complete - for example getting data from a server via an Ajax request, building a complex PDF document or any other asynchronous action. While the processing for that action is happening, it can be helpful to the end user to let them know that something is happening by showing a processing indicator. This method provides exactly that ability.

The typical use case will be to use this.processing( true ); at the start of an action function and that.processing( false ); inside a complete callback (where that = this).

Types

function button().processing()

Description:

Determine if a button is currently in the processing state or not.

Returns:

true if the button is currently in its processing state, false otherwise.

function button().processing( set )

Description:

Set the processing state for the selected button.

Parameters:
Returns:

DataTables API instance with the selected button in the result set, available for chaining further operations on the buttons.

Examples

Show button index 1 as processing:

var table = $('#myTable').DataTable();
table.button( 1 ).processing( true );

Use the processing method inside an action function:

var table = $('#myTable').DataTable();

table
	.button( 0 )
	.action( function () {
		this.processing( true );

		// Do something...

		this.processing( false );
	} );