<?xml version="1.0" encoding="UTF-8" ?>
<dt-api library="Buttons">
	<name>button().action()</name>
	<summary>Get / set the action function for the selected button</summary>
	<since>1.0.0</since>

	<type type="function">
		<signature>button().action()</signature>
		<returns type="function">
			Current action function.
		</returns>
		<description>
			Get the action function for the selected button.
		</description>
	</type>

	<type type="function">
		<signature>button().action( set )</signature>
		<parameter type="function" name="set">
			Function to set for the selected button's action method, replacing any action that was previously assigned to the button.

			The function takes four parameters:

			1. `-type object` Event object that triggered the event
			2. `-type DataTables.Api` A DataTables API instance for the host DataTable
			3. `-type jQuery` jQuery instance for the button node that was clicked on
			4. `-type object` The button's configuration object

			No return value is expected.

			The function is executed with in the scope of a DataTables API instance for the selected button (i.e. `b-api button()`) for the button in question.
		</parameter>
		<returns type="DataTables.Api">
			DataTables API instance with the selected button in the result set, available for chaining further operations on the button.
		</returns>
		<description>
			Set the action function for the selected button.
		</description>
	</type>

	<description>
		Like its plural counterpart (`b-api buttons().action()`) this method provides the ability to get or set the action function for a selected button - in this case limited to a single button only, and thus generally likely to be more useful as each button will typically provide a unique operation.

		The action function (which can be set on initialisation by `b-init buttons.buttons.action`) defines what the button will do when activated.

		Please note that when setting an action, the new function will replace any action that the button already has assigned to it. This is an important consideration as many button types define their own action that would no longer be executed if replaced.
	</description>

	<example title="Set a simple action function for button index 0"><![CDATA[

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

table.button( 0 ).action( function( e, dt, button, config ) {
	console.log( 'Button '+this.text()+' activated' );
	this.disable();
} );

]]></example>
</dt-api>