cardViewToggle
Toggle between the card and table view.
Please note - this property requires the CardView extension for DataTables.
Description
This button can be used to toggle between CardView's card view, and the default table view of DataTables. It will automatically update its text based on the current state, with the text reflecting what will happen when the button is activated.
There is just a single customisation for this button, which is the text displayed. It is suggested that you use the buttons.cardView and buttons.tableView options in language to configure the text.
Options
This button can have the following options set in its configuration object to customise its actions and display, in addition to those options which are available for all buttons (e.g. buttons.buttons.text):
text
- Type:
string - Default:
View cards | View table
The button's display text. The text can be configured using this option (see buttons.buttons.text) or use the buttons.cardView and buttons.tableView options of the DataTables language object. The correct option will be used based on the current view state.
Example
use the card view toggle button:
new DataTable('#myTable', {
cardView: true,
layout: {
topStart: {
buttons: ['cardViewToggle']
}
}
});