stateSaveParams

Since: DataTables 1.10

State save event - fired when saving table state information.

Description

The stateSaveParams event is the event compliment of the stateSaveParams initialisation option. As with the callback, the event is fired when the table has changed state a new state save is required. For the format of the data that is stored, please refer to the stateSaveCallback documentation.

This event allows modification of the state saving object prior to actually doing the save, including addition or other state properties (for plug-ins) or modification of a DataTables core property.

The stateSaveParams event is fired at the same point as stateSaveCallback (technically the callback fires before the event, but they occur sequentially and thus either can be used to achieve the same effect).

Please note that, as with all DataTables emitted events, this event is triggered with the dt namespace. As such, to listen for this event, you must also use the dt namespace by simply appending .dt to your event name, as shown in the example below.

Type

function function( e, settings, data )

Parameters:

Example

Remove a saved filter, so filtering is never saved:

$('#example')
	.dataTable()
	.on( 'stateSaveParams.dt', function (e, settings, data) {
		data.search.search = "";
	} );

Related

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