{hero}

state.clear()

Since: DataTables 1.10.1

Clear the saved state of the table.

Description

This method provides the ability to destroy a DataTables saved state which can be useful during development, or potentially when logging a user out if you want to clear the saved state before the state expires (stateDuration).

This method will trigger a DataTables state save but with an empty object (i.e. {}), effectively erasing any existing state data.

Note that if DataTables saves state after this method is called, the state will be stored again (a draw is the most common method of triggering a state save).

Type

function state.clear()

Description:

Clear the saved state of the table

Returns:

The API instance that was used, available for chaining.

Example

Clear the table state and reload the page:

table.state.clear();
window.location.reload();

Related

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