stateRestore.state()
Get a state from StateRestore.
Please note - this property requires the StateRestore extension for DataTables.
Description
This method provides the ability to retrieve a state that is managed by the StateRestore extension.
stateRestore.state() takes one argument, identifier. This string is used to identify the state throughout StateRestore.
A DataTables API instance is returned containing the state that is desired. This method will mainly be used for chaining.
Type
stateRestore.state()
Retrieves a stored state from the StateRestore extension.
Parameters:
| Name | Type | Optional | |
|---|---|---|---|
| 1 | identifier | No | |
The string that is used to identify this state. | |||
Returns:
DataTablesApi: Returns a DataTables API containing the desired state so that chaining can occur.
Example
Get a state called 'New State':
var table = new DataTable('#myTable', {
layout: {
topStart: {
buttons: ['createState', 'savedStates']
}
}
});
table.stateRestore.state('New State');Related
The following options are directly related and may also be useful in your application development.