{hero}

button-action

Since: Buttons 1.1.2

A button's action method has been triggered.
Please note - this property requires the Buttons extension for DataTables.

Description

This event is triggered whenever a button's action method is triggered by the end user (via keyboard, mouse or touch) or by the API (button().trigger()). It provides information about the button that was triggered through the parameters passed to it.

Note that the event is triggered after the action event. There is no ability to modify the action through this event.

Please note that, as with all DataTables emitted events, this event is triggered with the dt namespace. As such, if you use jQuery directly to listen for this event, you must also use the dt namespace by simply appending .dt to your event name. This is done automatically if you use the DataTables on() method.

Type

function function( e, buttonApi, dataTable, node, config )

Parameters:

Example

Show a message with the button name that was activated:

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

table.on( 'buttons-action', function ( e, buttonApi, dataTable, node, config ) {
	console.log( 'Button '+buttonApi.text()+' was activated' );
} );