Home Reference Source
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

Creates an instance of State

Member Summary

Public Members
public

Cookie duration in hours

public

Determines whether state is persisted with localStorage

public

Determines whether state is persisted with URL hash

public

Determines whether state is persisted with localStorage

public
public

Persist columns visibility

public

Persist filters values, enabled by default

public

Persist filters row visibility

public

Persist page length when paging is enabled

public

Persist current page number when paging is enabled

public

Persist column sorting

Method Summary

Public Methods
public

Destroy State instance

public

init()

Initializes State instance

public

override(state: *)

Override state field

public

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

Refresh hidden columns information on columns visibility changes

public

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

TableFilter configuration

public

TableFilter emitter instance

public

TableFilter feature setting

public

Feature name is the camelised class name as per TableFilter's convention

public

Field indicating whether Feature is initialized

public

TableFilter instance

public

Destroy the feature

public

Disable the feature

public

enable()

Enable the feature

public

init()

Initialize the feature

public

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:

NameTypeAttributeDescription
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

Field indicating whether Feature is initialized

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:

NameTypeAttributeDescription
state *

State object

public overrideAndSync(state: Object) source

Override current state with passed one and sync features

Params:

NameTypeAttributeDescription
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:

NameTypeAttributeDescription
hiddenCols Array

Columns indexes

public updateFiltersVisibility(visible: Boolean) source

Refresh filters visibility on filters visibility change

Params:

NameTypeAttributeDescription
visible Boolean

Visibility flad

public updatePage(pageNb: Number) source

Refresh page number field on page number changes

Params:

NameTypeAttributeDescription
pageNb Number

Current page number

public updatePageLength(pageLength: Number) source

Refresh page length field on page length changes

Params:

NameTypeAttributeDescription
pageLength Number

Current page length value

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

Refresh column sorting information on sort changes

Params:

NameTypeAttributeDescription
index *

{Number} Column index

descending Boolean

Descending manner