1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-02-28 01:54:15 +01:00

29 lines
1.3 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<dt-example table-type="html">
<css lib="datatables" />
<js lib="jquery" />
<js lib="datatables" />
<title>State saving</title>
<js><![CDATA[
$('#example').dataTable( {
"stateSave": true
} );
]]></js>
<info><![CDATA[
DataTables has the option of being able to save the state of a table (its paging position, sorting state etc) so that is can be restored when the user reloads a page, or comes back to it after visiting a sub-page. This state saving ability is enabled by the `dt-init stateSave` option.
The built in state saving method uses the HTML5 `localStorage` API for efficient storage of the data. PLease note that this means that the built in state saving option will not work with IE6/7 as these browsers do not support this API. Alternative options of using cookies or saving the state on the server through Ajax can be used through the `dt-init stateSaveCallback` and `dt-init stateLoadCallback` options.
Additionally, note also that the duration for which the saved state is valid and can be used to restore the table state can be set using the `dt-init stateDuration` initialisation parameter (2 hours by default).
The example below simply shows state saving enabled in DataTables with the `dt-init saveSave` option.
]]></info>
</dt-example>