{hero}

buttons().text()

Since: Buttons 1.0.0

Get / set the text for the selected buttons.
Please note - this property requires the Buttons extension for DataTables.

Description

This method provides the ability to dynamically get and set the display text of one or more buttons. This can be useful if an interaction (such as row selection) changes the behaviour of a button, to let the end user know what that change in behaviour is.

Types

function buttons().text()

Description:

Get the display text for the selected buttons.

Note that if the button's text option is specified as a function, this method will execute that function and return the result, so a string is always returned.

Returns:

A DataTables API instance where the result set contains the text from the selected buttons.

function buttons().text( set )

Description:

Set the display text for the selected buttons

Parameters:
Returns:

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

Examples

Get the text for all buttons:

var table = new DataTable('#myTable');
var buttonText = table.buttons().text();

console.log(buttonText.toArray());

Set text for all disabled buttons with HTML:

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

table.buttons('.disabled').text('<b>Not available</b>');

Use a function to display the text:

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

table.buttons([0, 1]).text(function (dt, button, config) {
	return dt.i18n('buttons.input', 'Input');
});