{hero}

buttons()

Since: Buttons 1.0.0

Select one or more buttons.
Please note - this property requires the Buttons extension for DataTables.

Description

The Buttons extension provides a powerful set of selector options so you can select which buttons to perform actions upon. This is very similar to the core DataTables rows(), columns() and cells() which provide the ability to select elements from the table, and more generally like jQuery selectors, so you will be immediately familiar with this interface.

Using the button-selector parameter it is possible to select one or more buttons that you wish to perform an operation on (for example changing the display text or enabling and disabling the button).

If no parameters are passed in, all buttons in all collections are selected.

Additionally, as it is possible to have multiple instances of the Buttons extension attached to a single DataTable, the button-group-selector option can be optionally included to select buttons from one or more button sets.

Type

function buttons( [ groupSelector, ] buttonSelector )

Description:

Select one or more buttons from the button instances attached to a DataTable.

Parameters:
Returns:

DataTables API instance where the result set contains information about the selected buttons so operations can be chained.

Examples

Disable all buttons with the class 'csv':

var table = new DataTable('#myTable');

table.buttons('.csv').disable();

Change the text for button indexes 2 and 2-0:

var table = new DataTable('#myTable');

table.buttons([2, '2-0']).text('Not available');

Select and disable all buttons from instance index 0:

var table = new DataTable('#myTable');

table.buttons(0, null).disable();

Enable all buttons with the class export from the instance with the name output:

var table = new DataTable('#myTable');

table.buttons('output:name', '.export').enable();