statesList
Collection used to show the saved states.
Please note - this property requires the StateRestore extension for DataTables.
Description
This button is a key interaction point for StateRestore. It makes use of a button collection (a dropdown) to show a list of saved states. Each saved state can have a split button (i.e. sub-options), depending on its configuration, which a user can use to edit, replace, delete or copy a state.
Please note that the label for this button defaults to "Saved states", which can be customised with the stateRestore.button.statesList language option (see language.stateRestore), or with the button's text option.
Furthermore, this button provides an alias name (savedStates) to assist with porting from StateRestore v1. The new name is preferred and should be used for all new projects.
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):
buttons
- Type:
array - Default:
[]
This option will accept an array with string or object entities, defining a list of buttons that will be shown before the list of states. All buttons defined by the Buttons library and any custom buttons can be used here - although you will likely wish to keep them relevant to saved states.
Examples
Simple use case:
new DataTable('#myTable', {
layout: {
topStart: {
buttons: ['stateCreate', 'statesList']
}
},
stateRestore: true
});Using the buttons property to add create and remove all buttons in the dropdown:
new DataTable('#example', {
layout: {
topStart: {
buttons: [
{
extend: 'statesList',
buttons: [
'stateCreate',
'statesRemoveAll',
{extend: 'spacer', style: 'bar'}
]
}
]
}
},
stateRestore: true
});