stateLoadParams
State load event - fired when loading state from storage.
Description
The stateLoadParams event is the event compliment of the stateLoadParams initialisation option. As with the callback, the event is fired when the table is loading state from the stored data, but prior to that read data being applied to the data table. This allows modification of the saved state data. For the format of the data that is stored, please refer to the stateSaveCallback documentation.
The stateLoadParams event is fired at the same point as stateLoadCallback (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, the event object has a DataTables API instance available on it in the dt property.
Type
function( e, settings, json )
Parameters:
| Name | Type | Optional | |
|---|---|---|---|
| 1 | e | No | |
Event object | |||
| 2 | settings | No | |
DataTables settings object | |||
| 3 | data | No | |
State information read from storage | |||
Example
Remove a saved filter from the saved state data:
new DataTable('#myTable', {
on: {
stateLoadParams: (e, settings, data) => {
data.search.search = '';
}
}
});Related
The following options are directly related and may also be useful in your application development.