    import {TableFilter} from 'tablefilter/src/tablefilter.js'

public class | source

# TableFilter

## Constructor Summary

Public Constructor
public | constructor (table: DOMElement, id: String, row: Number, configuration: Object) TableFilter object constructor |

## Member Summary

Public Members
public | Evt : * TF events ** |
public | ExtRegistry : * |
public | Mod : * |
public | activeColumnsCssClass : * |
public | activeFilterId : * |
public | activeFlt : * |
public | alternateBgs : * |
public | anOperator : * |
public | autoFilter : * autofilter on typing ** |
public | autoFilterDelay : * |
public | autoFilterTimer : * |
public | basePath : * |
public | btnCssClass : * |
public | btnFirstPageHtml : * |
public | btnLastPageHtml : * |
public | btnNextPageHtml : * |
public | btnPrevPageHtml : * |
public | btnReset : * |
public | btnResetCssClass : * |
public | btnResetHtml : * |
public | btnResetText : * |
public | btnText : * |
public | caseSensitive : * |
public | cfg : * |
public | colDateType : * |
public | colNbFormat : * |
public | colWidths : * |
public | contDivCssClass : * |
public | curExp : * |
public | customCellData : * |
public | customCellDataCols : * |
public | customOptions : * |
public | decimalSeparator : * |
public | defaultDateType : * data types ** |
public | dfOperator : * |
public | disableExcludedOptions : * |
public | displayAllText : * select filter's customisation and behaviours ** |
public | displayBtn : * validation - reset buttons/links ** |
public | emOperator : * |
public | emptyText : * |
public | enOperator : * |
public | enableDefaultTheme : * themes ** |
public | enableEmptyOption : * |
public | enableIcons : * |
public | enableNonEmptyOption : * |
public | enterKey : * filters' grid behaviours ** |
public | eqOperator : * |
public | exactMatch : * |
public | exactMatchByCol : * |
public | execDelay : * |
public | extensions : * extensions ** |
public | externalFltEls : * |
public | externalFltTgtIds : * |
public | filtersRowIndex : * |
public | fltCellTag : * |
public | fltCssClass : * |
public | fltElms : * |
public | fltGrid : * filters' grid properties ** |
public | fltGridEl : * |
public | fltIds : * |
public | fltMultiCssClass : * |
public | fltSmallCssClass : * |
public | fltTypeCheckList : string |
public | fltTypeInp : string filter types ** |
public | fltTypeMulti : string |
public | fltTypeNone : string |
public | fltTypeSlc : string |
public | fltsRowCssClass : * |
public | fltsValuesCookie : * |
public | geOperator : * |
public | grOperator : * |
public | gridLayout : * |
public | hasColDateType : * |
public | hasColNbFormat : * |
public | hasColWidths : * |
public | hasCustomOptions : * |
public | hasExactMatchByCol : * |
public | hasExtensions : * |
public | hasStoredValues : boolean cookies ** |
public | hasThemes : * |
public | hasVisibleRows : * |
public | headersRow : * |
public | helpInstructions : * |
public | highlightKeywords : * keyword highlighting ** |
public | id : * |
public | infDiv : * |
public | infDivCssClass : * |
public | isExternalFlt : * |
public | isFirstLoad : boolean |
public | isSortNumAsc : * |
public | isSortNumDesc : * |
public | isStartBgAlternate : boolean |
public | isUserTyping : * |
public | isWatermarkArray : * |
public | lDiv : * |
public | lDivCssClass : * |
public | leOperator : * |
public | linkedFilters : * |
public | lkOperator : * |
public | loadFltOnDemand : * |
public | loader : * loader ** |
public | loaderHtml : string |
public | loaderText : * |
public | lwOperator : * |
public | mDiv : * |
public | mDivCssClass : * |
public | markActiveColumns : * |
public | msgChangePage : * |
public | msgChangeResults : * |
public | msgClear : * |
public | msgFilter : * status messages ** |
public | msgLoadExtensions : * |
public | msgLoadThemes : * |
public | msgPopulate : * |
public | msgPopulateCheckList : * |
public | msgResetPage : * |
public | msgResetPageLength : * |
public | msgResetValues : * |
public | msgSort : * |
public | nbCells : * |
public | nbFilterableRows : * |
public | nbHiddenRows : number |
public | nbRows : * |
public | nbVisibleRows : number |
public | nmOperator : * |
public | nonEmptyText : * |
public | onAfterActiveColumn : * |
public | onAfterFilter : * |
public | onAfterReset : * |
public | onBeforeActiveColumn : * |
public | onBeforeFilter : * |
public | onBeforeReset : * |
public | onFiltersLoaded : * |
public | onRowValidated : * |
public | onSlcChange : * |
public | orOperator : * |
public | paging : * paging ** |
public | pgLenCookie : * |
public | pgNbCookie : * |
public | popUpFilters : * |
public | prfxCookieFltsValues : string |
public | prfxCookiePageLen : string |
public | prfxCookiePageNb : string |
public | prfxFlt : string |
public | prfxInfDiv : string |
public | prfxLDiv : string |
public | prfxMDiv : string |
public | prfxRDiv : string |
public | prfxTf : string ids prefixes ** |
public | prfxValButton : string |
public | rDiv : * |
public | rDivCssClass : * |
public | refRow : * |
public | rememberGridValues : * |
public | rememberPageLen : * |
public | rememberPageNb : * |
public | rgxOperator : * Filter operators ** |
public | rowsCounter : * rows counter ** |
public | searchArgs : * |
public | separator : * |
public | singleFltCssClass : * |
public | singleSearchFlt : * |
public | sortNumAsc : * |
public | sortNumDesc : * |
public | sortSlc : * |
public | stOperator : * |
public | startRow : * |
public | statusBar : * status bar ** |
public | stylePath : * filters' grid appearance ** |
public | stylesheet : * |
public | stylesheetId : * |
public | tbl : * |
public | themes : * |
public | themesPath : * |
public | thousandsSeparator : * |
public | toolBarTgtId : * |
public | validRowsIndex : * |
public | version : string |
public | visibleRows : * |
public | watermark : * |
public | year : * |

## Method Summary

Public Methods
public | EvtManager (evt: String, cfg: Object) Manages state messages |
public | applyProps () Re-apply the features/behaviour concerned by filtering/paging operation |
public | clearActiveColumns () Clears filtered columns visual indicator (background color) |
public | clearFilters () |
public | config (): Object Get the configuration object (literal object) |
public | destroy () Destroy filter grid |
public | destroyExtensions () Destroy all the extensions defined in the configuration object |
public | enforceVisibility () Makes defined rows always visible |
public | extension (name: String): Object Get an extension instance |
public | feature (name: String): Object Return a feature instance for a given name |
public | filter () |
public | getCellData (i: Number, cell: Object): String Return the data of a given cell |
public | getCellsNb (rowIndex: Number): Number Return the number of cells for a given row index |
public | getColValues (colindex: Number, num: Boolean, exclude: Array): Array Return the data of a specified colum |
public | getCustomOptions (colIndex: Number): Array Returns an array [[value0, value1 ...],[text0, text1 ...]] with the |
public | getFilterElement (index: Number): DOMElement Return the filter's DOM element for a given column |
public | getFilterId (index: Number): String Return the ID of the filter of a specified column |
public | getFilterType (colIndex: Number): String Return the filter type for a specified column |
public | getFilterValue (index: Number): String Return the filter's value of a specified column |
public | getFilterableRowsNb (): Number Get the total number of filterable rows |
public | getFilteredData (includeHeaders: Boolean): Array Return the filtered data with following format: |
public | getFilteredDataCol (colIndex: Number): Array Return the filtered data for a given column index |
public | getFiltersByType (type: String, bool: Boolean): [type] Return the list of ids of filters matching a specified type. |
public | getFiltersId (): [type] Get list of filter IDs |
public | getFiltersRowIndex (): Number Get the index of the row containing the filters |
public | getFiltersValue (): Array Return the filters' values |
public | getHeaderElement (colIndex: Number): Object Get the header DOM element for a given column index |
public | getHeadersRowIndex (): Number Get the index of the headers row |
public | getLastRowIndex (): Number Get the index of the last row |
public | getRowDisplay (DOM: RowElement): String Get the display value of a row |
public | getRowsNb (includeHeaders: Boolean): Number Return the number of filterable rows starting from reference row if |
public | getStartRowIndex (): Number Get the row index from where the filtering process start (1st filterable |
public | getStylesheet (name: string): DOMElement Return stylesheet DOM element for a given theme name |
public | getTableData (includeHeaders: Boolean): Array Return the table data with following format: |
public | getValidRows (reCalc: Boolean): Array Get filtered (valid) rows indexes |
public | hasExtension (name: String): Boolean Check passed extension name exists |
public | hasGrid (): Boolean Check if table has filters grid |
public | import (fileId: String, filePath: String, callback: Function, type: String) Import script or stylesheet |
public | init () Initialise filtering grid bar behaviours and layout |
public | initExtensions () Initialise all the extensions defined in the configuration object |
public | isCustomOptions (colIndex: Number): Boolean Check if given column implements a filter with custom options |
public | isExactMatch (colIndex: Number): Boolean Determines if passed filter column implements exact query match |
public | isImported (filePath: String, type: String): Boolean Check if passed script or stylesheet is already imported |
public | linkFilters () Refresh the filters subject to linking ('select', 'multiple', |
public | loadExtension (ext: Object) Load an extension module |
public | loadThemes () |
public | removeExternalFlts () Remove all the external column filters |
public | removeToolbar () Remove toolbar container element |
public | resetValues () |
public | setColWidths (rowIndex: Number, tbl: Element) Set them columns' widths as per configuration |
public | setFilterValue (index: Number, searcharg: String) Set search value to a given filter |
public | setToolbar () Generate container element for paging, reset button, rows counter etc. |
public | validateAllRows () Validate all filterable rows |
public | validateRow (rowIndex: Number, isValid: Boolean) Validate/invalidate row by setting the 'validRow' attribute on the row |

## Public Constructors

### public constructor(table: DOMElement, id: String, row: Number, configuration: Object) source

TableFilter object constructor requires `table` or `id` arguments, `row` and `configuration` optional

#### Params:

Name | Type | Attribute | Description
table | DOMElement |  | Table DOM element
id | String |  | Table id
row | Number |  | index indicating the 1st row
configuration | Object |  | object

## Public Members

### public Evt: * source

TF events **

### public ExtRegistry: * source

### public Mod: * source

### public activeColumnsCssClass: * source

### public activeFilterId: * source

### public activeFlt: * source

### public alternateBgs: * source

### public anOperator: * source

### public autoFilter: * source

autofilter on typing **

### public autoFilterDelay: * source

### public autoFilterTimer: * source

### public basePath: * source

### public btnCssClass: * source

### public btnFirstPageHtml: * source

### public btnLastPageHtml: * source

### public btnNextPageHtml: * source

### public btnPrevPageHtml: * source

### public btnReset: * source

### public btnResetCssClass: * source

### public btnResetHtml: * source

### public btnResetText: * source

### public btnText: * source

### public caseSensitive: * source

### public cfg: * source

### public colDateType: * source

### public colNbFormat: * source

### public colWidths: * source

### public contDivCssClass: * source

### public curExp: * source

### public customCellData: * source

### public customCellDataCols: * source

### public customOptions: * source

### public decimalSeparator: * source

### public defaultDateType: * source

data types **

### public dfOperator: * source

### public disableExcludedOptions: * source

### public displayAllText: * source

select filter's customisation and behaviours **

### public displayBtn: * source

validation - reset buttons/links **

### public emOperator: * source

### public emptyText: * source

### public enOperator: * source

### public enableDefaultTheme: * source

themes **

### public enableEmptyOption: * source

### public enableIcons: * source

### public enableNonEmptyOption: * source

### public enterKey: * source

filters' grid behaviours **

### public eqOperator: * source

### public exactMatch: * source

### public exactMatchByCol: * source

### public execDelay: * source

### public extensions: * source

extensions **

### public externalFltEls: * source

### public externalFltTgtIds: * source

### public filtersRowIndex: * source

### public fltCellTag: * source

### public fltCssClass: * source

### public fltElms: * source

### public fltGrid: * source

filters' grid properties **

### public fltGridEl: * source

### public fltIds: * source

### public fltMultiCssClass: * source

### public fltSmallCssClass: * source

### public fltTypeCheckList: string source

### public fltTypeInp: string source

filter types **

### public fltTypeMulti: string source

### public fltTypeNone: string source

### public fltTypeSlc: string source

### public fltsRowCssClass: * source

### public fltsValuesCookie: * source

### public geOperator: * source

### public grOperator: * source

### public gridLayout: * source

### public hasColDateType: * source

### public hasColNbFormat: * source

### public hasColWidths: * source

### public hasCustomOptions: * source

### public hasExactMatchByCol: * source

### public hasExtensions: * source

### public hasStoredValues: boolean source

cookies **

### public hasThemes: * source

### public hasVisibleRows: * source

### public headersRow: * source

### public helpInstructions: * source

### public highlightKeywords: * source

keyword highlighting **

### public id: * source

### public infDiv: * source

### public infDivCssClass: * source

### public isExternalFlt: * source

### public isFirstLoad: boolean source

### public isSortNumAsc: * source

### public isSortNumDesc: * source

### public isStartBgAlternate: boolean source

### public isUserTyping: * source

### public isWatermarkArray: * source

### public lDiv: * source

### public lDivCssClass: * source

### public leOperator: * source

### public linkedFilters: * source

### public lkOperator: * source

### public loadFltOnDemand: * source

### public loader: * source

loader **

### public loaderHtml: string source

### public loaderText: * source

### public lwOperator: * source

### public mDiv: * source

### public mDivCssClass: * source

### public markActiveColumns: * source

### public msgChangePage: * source

### public msgChangeResults: * source

### public msgClear: * source

### public msgFilter: * source

status messages **

### public msgLoadExtensions: * source

### public msgLoadThemes: * source

### public msgPopulate: * source

### public msgPopulateCheckList: * source

### public msgResetPage: * source

### public msgResetPageLength: * source

### public msgResetValues: * source

### public msgSort: * source

### public nbCells: * source

### public nbFilterableRows: * source

### public nbHiddenRows: number source

### public nbRows: * source

### public nbVisibleRows: number source

### public nmOperator: * source

### public nonEmptyText: * source

### public onAfterActiveColumn: * source

### public onAfterFilter: * source

### public onAfterReset: * source

### public onBeforeActiveColumn: * source

### public onBeforeFilter: * source

### public onBeforeReset: * source

### public onFiltersLoaded: * source

### public onRowValidated: * source

### public onSlcChange: * source

### public orOperator: * source

### public paging: * source

paging **

### public pgLenCookie: * source

### public pgNbCookie: * source

### public popUpFilters: * source

### public prfxCookieFltsValues: string source

### public prfxCookiePageLen: string source

### public prfxCookiePageNb: string source

### public prfxFlt: string source

### public prfxInfDiv: string source

### public prfxLDiv: string source

### public prfxMDiv: string source

### public prfxRDiv: string source

### public prfxTf: string source

ids prefixes **

### public prfxValButton: string source

### public rDiv: * source

### public rDivCssClass: * source

### public refRow: * source

### public rememberGridValues: * source

### public rememberPageLen: * source

### public rememberPageNb: * source

### public rgxOperator: * source

Filter operators **

### public rowsCounter: * source

rows counter **

### public searchArgs: * source

### public separator: * source

### public singleFltCssClass: * source

### public singleSearchFlt: * source

### public sortNumAsc: * source

### public sortNumDesc: * source

### public sortSlc: * source

### public stOperator: * source

### public startRow: * source

### public statusBar: * source

status bar **

### public stylePath: * source

filters' grid appearance **

### public stylesheet: * source

### public stylesheetId: * source

### public tbl: * source

### public themes: * source

### public themesPath: * source

### public thousandsSeparator: * source

### public toolBarTgtId: * source

### public validRowsIndex: * source

### public version: string source

### public visibleRows: * source

### public watermark: * source

### public year: * source

## Public Methods

### public EvtManager(evt: String, cfg: Object) source

Manages state messages

#### Params:

Name | Type | Attribute | Description
evt | String |  | Event name
cfg | Object |  | Config object

### public applyProps() source

Re-apply the features/behaviour concerned by filtering/paging operation

NOTE: this will disappear whenever custom events in place

### public clearActiveColumns() source

Clears filtered columns visual indicator (background color)

### public clearFilters() source

### public config(): Object source

Get the configuration object (literal object)

#### Return:

Object

### public destroy() source

Destroy filter grid

### public destroyExtensions() source

Destroy all the extensions defined in the configuration object

### public enforceVisibility() source

Makes defined rows always visible

### public extension(name: String): Object source

Get an extension instance

#### Params:

Name | Type | Attribute | Description
name | String |  | Name of the extension

#### Return:

Object | Extension instance

### public feature(name: String): Object source

Return a feature instance for a given name

#### Params:

Name | Type | Attribute | Description
name | String |  | Name of the feature

#### Return:

Object

### public filter() source

### public getCellData(i: Number, cell: Object): String source

Return the data of a given cell

#### Params:

Name | Type | Attribute | Description
i | Number |  | Column's index
cell | Object |  | Cell's DOM object

#### Return:

String

### public getCellsNb(rowIndex: Number): Number source

Return the number of cells for a given row index

#### Params:

Name | Type | Attribute | Description
rowIndex | Number |  | Index of the row

#### Return:

Number | Number of cells

### public getColValues(colindex: Number, num: Boolean, exclude: Array): Array source

Return the data of a specified colum

#### Params:

Name | Type | Attribute | Description
colindex | Number |  | Column index
num | Boolean |  | Return unformatted number
exclude | Array |  | List of row indexes to be excluded

#### Return:

Array | Flat list of data for a column

### public getCustomOptions(colIndex: Number): Array source

Returns an array [[value0, value1 ...],[text0, text1 ...]] with the custom options values and texts

#### Params:

Name | Type | Attribute | Description
colIndex | Number |  | Column's index

#### Return:

Array

### public getFilterElement(index: Number): DOMElement source

Return the filter's DOM element for a given column

#### Params:

Name | Type | Attribute | Description
index | Number |  | Column's index

#### Return:

DOMElement

### public getFilterId(index: Number): String source

Return the ID of the filter of a specified column

#### Params:

Name | Type | Attribute | Description
index | Number |  | Column's index

#### Return:

String | ID of the filter element

### public getFilterType(colIndex: Number): String source

Return the filter type for a specified column

#### Params:

Name | Type | Attribute | Description
colIndex | Number |  | Column's index

#### Return:

String

### public getFilterValue(index: Number): String source

Return the filter's value of a specified column

#### Params:

Name | Type | Attribute | Description
index | Number |  | Column index

#### Return:

String | Filter value

### public getFilterableRowsNb(): Number source

Get the total number of filterable rows

#### Return:

Number

### public getFilteredData(includeHeaders: Boolean): Array source

Return the filtered data with following format: [ [rowIndex, [value0, value1...]], [rowIndex, [value0, value1...]] ]

#### Params:

Name | Type | Attribute | Description
includeHeaders | Boolean |  | Include headers row

#### Return:

Array | TODO: provide an API returning data in JSON format

### public getFilteredDataCol(colIndex: Number): Array source

Return the filtered data for a given column index

#### Params:

Name | Type | Attribute | Description
colIndex | Number |  | Colmun's index

#### Return:

Array | Flat list of values ['val0','val1','val2'...] TODO: provide an API returning data in JSON format

### public getFiltersByType(type: String, bool: Boolean): [type] source

Return the list of ids of filters matching a specified type. Note: hidden filters are also returned

#### Params:

Name | Type | Attribute | Description
type | String |  | Filter type string ('input', 'select', 'multiple', 'checklist')
bool | Boolean |  | If true returns columns indexes instead of IDs

#### Return:

[type] | List of element IDs or column indexes

### public getFiltersId(): [type] source

Get list of filter IDs

#### Return:

[type] | [description]

### public getFiltersRowIndex(): Number source

Get the index of the row containing the filters

#### Return:

Number

### public getFiltersValue(): Array source

Return the filters' values

#### Return:

Array | List of filters' values

### public getHeaderElement(colIndex: Number): Object source

Get the header DOM element for a given column index

#### Params:

Name | Type | Attribute | Description
colIndex | Number |  | Column index

#### Return:

Object

### public getHeadersRowIndex(): Number source

Get the index of the headers row

#### Return:

Number

### public getLastRowIndex(): Number source

Get the index of the last row

#### Return:

Number

### public getRowDisplay(DOM: RowElement): String source

Get the display value of a row

#### Params:

Name | Type | Attribute | Description
DOM | RowElement |  | element of the row

#### Return:

String | Usually 'none' or ''

### public getRowsNb(includeHeaders: Boolean): Number source

Return the number of filterable rows starting from reference row if defined

#### Params:

Name | Type | Attribute | Description
includeHeaders | Boolean |  | Include the headers row

#### Return:

Number | Number of filterable rows

### public getStartRowIndex(): Number source

Get the row index from where the filtering process start (1st filterable row)

#### Return:

Number

### public getStylesheet(name: string): DOMElement source

Return stylesheet DOM element for a given theme name

#### Params:

Name | Type | Attribute | Description

name

string

- optional
- default: default

#### Return:

DOMElement | stylesheet element

### public getTableData(includeHeaders: Boolean): Array source

Return the table data with following format: [ [rowIndex, [value0, value1...]], [rowIndex, [value0, value1...]] ]

#### Params:

Name | Type | Attribute | Description
includeHeaders | Boolean |  | Include headers row

#### Return:

Array | TODO: provide an API returning data in JSON format

### public getValidRows(reCalc: Boolean): Array source

Get filtered (valid) rows indexes

#### Params:

Name | Type | Attribute | Description
reCalc | Boolean |  | Force calculation of filtered rows list

#### Return:

Array | List of row indexes

### public hasExtension(name: String): Boolean source

Check passed extension name exists

#### Params:

Name | Type | Attribute | Description
name | String |  | Name of the extension

#### Return:

Boolean

### public hasGrid(): Boolean source

Check if table has filters grid

#### Return:

Boolean

### public import(fileId: String, filePath: String, callback: Function, type: String) source

Import script or stylesheet

#### Params:

Name | Type | Attribute | Description
fileId | String |  | Ressource ID
filePath | String |  | Ressource path
callback | Function |  | Callback
type | String |  | Possible values: 'script' or 'link'

### public init() source

Initialise filtering grid bar behaviours and layout

TODO: decompose in smaller methods

### public initExtensions() source

Initialise all the extensions defined in the configuration object

### public isCustomOptions(colIndex: Number): Boolean source

Check if given column implements a filter with custom options

#### Params:

Name | Type | Attribute | Description
colIndex | Number |  | Column's index

#### Return:

Boolean

### public isExactMatch(colIndex: Number): Boolean source

Determines if passed filter column implements exact query match

#### Params:

Name | Type | Attribute | Description
colIndex | Number |  | [description]

#### Return:

Boolean | [description]

### public isImported(filePath: String, type: String): Boolean source

Check if passed script or stylesheet is already imported

#### Params:

Name | Type | Attribute | Description
filePath | String |  | Ressource path
type | String |  | Possible values: 'script' or 'link'

#### Return:

Boolean

### public linkFilters() source

Refresh the filters subject to linking ('select', 'multiple', 'checklist' type)

### public loadExtension(ext: Object) source

Load an extension module

#### Params:

Name | Type | Attribute | Description
ext | Object |  | Extension config object

### public loadThemes() source

### public removeExternalFlts() source

Remove all the external column filters

### public removeToolbar() source

Remove toolbar container element

### public resetValues() source

### public setColWidths(rowIndex: Number, tbl: Element) source

Set them columns' widths as per configuration

#### Params:

Name | Type | Attribute | Description
rowIndex | Number |  | Optional row index to apply the widths to
tbl | Element |  | DOM element

### public setFilterValue(index: Number, searcharg: String) source

Set search value to a given filter

#### Params:

Name | Type | Attribute | Description
index | Number |  | Column's index
searcharg | String |  | Search term

### public setToolbar() source

Generate container element for paging, reset button, rows counter etc.

### public validateAllRows() source

Validate all filterable rows

### public validateRow(rowIndex: Number, isValid: Boolean) source

Validate/invalidate row by setting the 'validRow' attribute on the row

#### Params:

Name | Type | Attribute | Description
rowIndex | Number |  | Index of the row
isValid | Boolean |  |