# State | tablefilter v0.4.16 API Document

    import {State} from 'tablefilter/src/modules/state.js'

public class | source

# State

#### Extends:

Feature → State

Features state object persistable with localStorage, cookie or URL hash

## Constructor Summary

Public Constructor
public | constructor (tf: TableFilter) Creates an instance of State |

## Member Summary

Public Members
public | cookieDuration : Boolean Cookie duration in hours |
public | enableCookie : Boolean Determines whether state is persisted with localStorage |
public | enableHash : Boolean Determines whether state is persisted with URL hash |
public | enableLocalStorage : Boolean Determines whether state is persisted with localStorage |
public | initialized : boolean |
public | persistColsVisibility : Boolean Persist columns visibility |
public | persistFilters : Boolean Persist filters values, enabled by default |
public | persistFiltersVisibility : Boolean Persist filters row visibility |
public | persistPageLength : Boolean Persist page length when paging is enabled |
public | persistPageNumber : Boolean Persist current page number when paging is enabled |
public | persistSort : Boolean Persist column sorting |

## Method Summary

Public Methods
public | destroy () Destroy State instance |
public | init () Initializes State instance |
public | override (state: *) Override state field |
public | overrideAndSync (state: Object) Override current state with passed one and sync features |
public | sync () Sync stored features state |
public | update () Update state object based on current features state |
public | updateColsVisibility (hiddenCols: Array) Refresh hidden columns information on columns visibility changes |
public | updateFiltersVisibility (visible: Boolean) Refresh filters visibility on filters visibility change |
public | updatePage (pageNb: Number) Refresh page number field on page number changes |
public | updatePageLength (pageLength: Number) Refresh page length field on page length changes |
public | updateSort (index: *, descending: Boolean) Refresh column sorting information on sort changes |

## Inherited Summary

From class Feature
public | config : Object TableFilter configuration |
public | emitter : Emitter TableFilter emitter instance |
public | enabled : Boolean TableFilter feature setting |
public | feature : String Feature name |
public | initialized : Boolean Field indicating whether Feature is initialized |
public | tf : TableFilter TableFilter instance |
public | destroy () Destroy the feature |
public | disable () Disable the feature |
public | enable () Enable the feature |
public | init () Initialize the feature |
public | isEnabled (): Boolean Indicate whether the feature is enabled or not |
public | reset () Reset the feature after being disabled |

## Public Constructors

### public constructor(tf: TableFilter) source

Creates an instance of State

#### Override:

Feature#constructor

#### Params:

Name | Type | Attribute | Description
tf | TableFilter |  | TableFilter instance

## Public Members

### public cookieDuration: Boolean source

Cookie duration in hours

### public enableCookie: Boolean source

Determines whether state is persisted with localStorage

### public enableHash: Boolean source

Determines whether state is persisted with URL hash

### public enableLocalStorage: Boolean source

Determines whether state is persisted with localStorage

### public initialized: boolean source

#### Override:

Feature#initialized

### public persistColsVisibility: Boolean source

Persist columns visibility

### public persistFilters: Boolean source

Persist filters values, enabled by default

### public persistFiltersVisibility: Boolean source

Persist filters row visibility

### public persistPageLength: Boolean source

Persist page length when paging is enabled

### public persistPageNumber: Boolean source

Persist current page number when paging is enabled

### public persistSort: Boolean source

Persist column sorting

## Public Methods

### public destroy() source

Destroy State instance

#### Override:

Feature#destroy

### public init() source

Initializes State instance

#### Override:

Feature#init

### public override(state: *) source

Override state field

#### Params:

Name | Type | Attribute | Description
state | * |  | State object

### public overrideAndSync(state: Object) source

Override current state with passed one and sync features

#### Params:

Name | Type | Attribute | Description
state | Object |  | State object

### public sync() source

Sync stored features state

### public update() source

Update state object based on current features state

### public updateColsVisibility(hiddenCols: Array) source

Refresh hidden columns information on columns visibility changes

#### Params:

Name | Type | Attribute | Description
hiddenCols | Array |  | Columns indexes

### public updateFiltersVisibility(visible: Boolean) source

Refresh filters visibility on filters visibility change

#### Params:

Name | Type | Attribute | Description
visible | Boolean |  | Visibility flad

### public updatePage(pageNb: Number) source

Refresh page number field on page number changes

#### Params:

Name | Type | Attribute | Description
pageNb | Number |  | Current page number

### public updatePageLength(pageLength: Number) source

Refresh page length field on page length changes

#### Params:

Name | Type | Attribute | Description
pageLength | Number |  | Current page length value

### public updateSort(index: *, descending: Boolean) source

Refresh column sorting information on sort changes

#### Params:

Name | Type | Attribute | Description
index | * |  | {Number} Column index
descending | Boolean |  | Descending manner