1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-03 07:03:33 +02:00
7 1.17 State
cjohnsonuk edited this page 2016-06-21 15:44:57 +01:00

With the State manager, TableFilter can easily persist features state via hash, localStorage or cookie. The State object reacts to the features state changes and emits a state-changed event along with a state object to be persisted by the relevant listeners, ie Storage object.

Property Type Description Remarks Example
types array

an array specifying the persistence type, that is:

  • hash (URL hash)
  • local_storage
  • cookie
var tfConfig = { state: { types: ['local_storage'] };
filters boolean if set true, columns filter values will be persisted via selected storage type (default - true) disabled only if explicitly set false var tfConfig = { state: { types: ['hash'], filters: false };
page_number boolean if set true, the current page number will be persisted via selected storage type (default - false) applicable only if paging is enabled var tfConfig = { paging: true, state: { types: ['hash'], page_number: true };
page_length boolean if set true, the page length (number of lines per page) will be persisted via selected storage type (default - false) applicable only if paging is enabled var tfConfig = { paging: true, state: { types: ['hash'], page_length: true };
sort boolean if set true, the currently sorted column will be persisted via selected storage type (default - false) applicable only if sort extension is enabled var tfConfig = { extensions: [{ name: 'sort'}], state: { types: ['cookie'], sort: true };
columns_visibility boolean if set true, currently hidden columns will be persisted via selected storage type (default - false) applicable only if colsVisibility extension is enabled var tfConfig = { extensions: [{ name: 'colsVisibility'}], state: { types: ['cookie'], columns_visibility: true };
filters_visibility boolean if set true, filters row visibility will be persisted via selected storage type (default - false) applicable only if filtersVisibility extension is enabled var tfConfig = { extensions: [{ name: 'filtersVisibility'}], state: { types: ['cookie'], filters_visibility: true };
cookie_duration number cookie duration expressed in hours if persistence type is cookie (default - 87600) applicable only if cookies is chosen as the persistence type var tfConfig = { state: { types: ['cookie', 'hash'], cookie_duration: 100000 };