buttons
Buttons configuration object.
Please note - this property requires the Buttons extension for DataTables.
Description
This property is an alias of the feature property buttons
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
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
for full details.
Examples
Creation of Buttons using defaults and insertion by dom
:
new DataTable('#myTable', {
layout: {
topStart: 'buttons'
},
buttons: true
});
Creation of Buttons with array configuration of buttons and insertion by dom
:
new DataTable('#myTable', {
layout: {
topStart: 'buttons'
},
buttons: ['copy', 'csv', 'excel']
});
Creation of Buttons with object configuration and insertion by dom
:
new DataTable('#myTable', {
layout: {
topStart: 'buttons'
},
buttons: {
name: 'primary',
buttons: ['copy', 'csv', 'excel']
}
});