buttons.buttons.extend
Define which button type the button should be based on.
Please note - this property requires the Buttons extension for DataTables.
Description
When creating buttons you may often wish to customise an existing button type, for example modifying the display text, while still making use of the functionality that the button offers, without rewriting a whole lot of code! This extends
option provides exactly that ability.
The buttons created can extend multiple existing button types - for example a customised button might extend any built in button type, and that customised button might itself be extended during initialisation to set the button text.
The extends
option is not required, however, if it is not provided, the buttons.buttons.text
and buttons.buttons.action
options must be defined.
Type
string
- Description:
Define the existing button type to extend. This need not be a built-in button type, it can be any that has been defined by the time that Buttons is initialised.
Default
- Value:
undefined
Example
Two buttons, one with customisations:
new DataTable('#myTable', {
layout: {
topEnd: {
buttons: ['copy', { extend: 'excel', text: 'Save as Excel' }]
}
}
});