stateRestore.state()

Since: StateRestore 1.0.0

Select a saved state.
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 and matches against the id property in StateRestore.State.

The returned object is a DataTables API instance with methods available on it specifically for use to manage the selected state. Please see the related methods below.

Type

stateRestore.state(identifier)

Retrieves a stored state from the StateRestore extension.

Parameters:

Returns:

DataTable.Api:
Returns a DataTables API instance containing the desired state so that chained methods can be used.

Example

Get all states and then display their details on the console:

let ids = table.stateRestore.states().details().map(s => s.id);

ids.forEach(id => {
	console.log(table.stateRestore.state(id).details());
});

Related

The following options are directly related and may also be useful in your application development.