buttons.buttons.text
The text to show in the button.
Please note - this property requires the Buttons extension for DataTables.
Description
This property is an alias of the feature property buttons.buttons.text
and can be used to configure the feature from the top level DataTables configuration object, rather than in the layout
option (see example below). This lets you use the feature as a string rather than an object, but it does restrict the configuration if you were using multiple instances of the feature. Please refer to the documentation for buttons.buttons.text
for full details and options that apply to this option.
If you are using DataTables 1.x, which does not have the layout
option, use this property name, but referring to the documentation for buttons.buttons.text
for full details.
Examples
Set the text :
new DataTable('#myTable', {
layout: {
topStart: 'buttons'
},
buttons: [{ extend: 'copy', text: 'Copy to clipboard' }]
});
Highlight an action key using HTML:
new DataTable('#myTable', {
layout: {
topStart: 'buttons'
},
buttons: [
{
extend: 'print',
text: '<em>P</em>rint',
key: {
key: 'p',
altkey: true
}
}
]
});
Internationalisation using the i18n()
method::
new DataTable('#myTable', {
layout: {
topStart: 'buttons'
},
buttons: [
{
extend: 'print',
text: function (dt, button, config) {
return dt.i18n('buttons.print', 'Print');
}
}
]
});