Since: Buttons 1.0.0

Disable the selected buttons.
Please note - this property requires the Buttons extension for DataTables.


It can often be useful to enable and disable buttons based on some external logic. A common example is an Edit button that is disabled when no rows are selected in a table.

When a button is disabled its visual appearance is updated to show its deactivated status (this is done by adding the class disabled to the button element). Additionally, when a disabled button is clicked on (or otherwise activated by the keyboard or button().trigger()) the button's action is not executed.

This method can be used to dynamically disable buttons. Unlike its counterpart method, buttons().enable(), this method cannot be used to both enable and disable buttons, it can only be used to disable.


function buttons().disable()


Disable the selected buttons.


DataTables API instance with the selected buttons in the result set, available for chaining further operations on the buttons.


Disable all buttons:

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


Set enabled state on a logic condition:

var table = new DataTable('#myTable');
var buttons = table.buttons(['.edit', '.delete']);

if (table.rows({ selected: true }).indexes().length === 0) {
else {