{hero}

stateSaveParams

Since: DataTables 1.10

State save - data manipulation callback.

Description

Callback which allows modification of the parameters to be saved for the DataTables state saving prior to the data actually being saved. This callback is called every time DataTables requests that the state be saved. As of 1.11.0 this occurs regardless of the value of stateSave so that the state is always being tracked. The state is only reloaded if this option is activated. For the format of the data that is stored, please refer to the stateSaveCallback documentation.

Note that the stateSaveCallback option is used to define where and how to store the state, while this function is used to manipulate the data before it is entered into storage. This will only be available when stateSave is active.

Further note that for plug-in authors, you should use the stateSaveParams event to add extra parameters to the state storage object if required.

Type

function stateSaveParams( settings, data )

Parameters:

Example

Remove a saved filter, so filtering is never saved:

new DataTable('#myTable', {
	stateSave: true,
	stateSaveParams: function (settings, data) {
		data.search.search = '';
	}
});

Related

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