-
Notifications
You must be signed in to change notification settings - Fork 90
1.17 State
cjohnsonuk edited this page Jun 21, 2016
·
7 revisions
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:
|
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 }; |