Since: Buttons 1.0.0

Select a single button.
Please note - this property requires the Buttons extension for DataTables.


Like the core DataTables API, Buttons provides a plural / singular API where operations can be performed on a single button, or multiple. With Buttons it is likely that your typical use of the API will use a single button thought this method, but buttons() can also be useful for certain operations.

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 row(), column() and cell() 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 the button that you wish to perform an operation on (for example changing the display text or enabling and disabling the button).

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 a button from a specific button set, or searching over multiple sets.

Important: If the selectors used result in more that one button being selected, this method will automatically truncate the result to the first button found only.


function button( [ groupSelector, ] buttonSelector )


Select a single button from the button instances attached to a DataTable.


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


Disable the button at index position 2:

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


Change the text for collection button with index 3-1:

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

table.button('3-1').text('Not available');

Select and disable button index 1 from button instance index 0:

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

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

Enable the button with the name csv from instance index 1:

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

table.buttons(1, 'csv:name').enable();