Select one or more buttons. Please note - this property requires the Buttons extension for DataTables.
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
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.
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.
function buttons( [ groupSelector, ] buttonSelector )
Select one or more buttons from the button instances attached to a DataTable.
Name Type Optional 1
Yes - default:undefined
Button group (instance) selector. Provides the ability to select buttons from one or more instances of the Buttons class.
By default this is
undefinedresulting in all instances attached to the DataTable being selected.
Selector to obtain the buttons that should be acted upon.
DataTables API instance where the result set contains information about the selected buttons so operations can be chained.
Disable all buttons with the class 'csv':
var table = $('#myTable').DataTable(); table.buttons( '.csv' ).disable();
Change the text for button indexes 2 and 2-0:
var table = $('#myTable').DataTable(); table.buttons( [2, '2-0'] ).text( 'Not available' );
Select and disable all buttons from instance index 0:
var table = $('#myTable').DataTable(); table.buttons( 0, null ).disable();
Enable all buttons with the class
export from the instance with the name
var table = $('#myTable').DataTable(); table.buttons( 'output:name', '.export' ).enable();