    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 requires `table` or `id` arguments, `row` and `configuration` optional |

## Member Summary

Public Members
public | Evt: * TF events ** |
public | ExtRegistry: * |
public | Mod: * |
public | activeColumnsCssClass: * |
public | activeFilterId: * |
public | activeFlt: * |
public | alternateRows: * |
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 | emitter: * |
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 | geOperator: * |
public | grOperator: * |
public | gridLayout: * |
public | hasColDateType: * |
public | hasColNbFormat: * |
public | hasColWidths: * |
public | hasCustomOptions: * |
public | hasExactMatchByCol: * |
public | hasExtensions: * |
public | hasPersistence: * |
public | hasThemes: * |
public | hasVisibleRows: * |
public | headersRow: * |
public | help: * |
public | highlightKeywords: * keyword highlighting ** |
public | id: * |
public | infDiv: * |
public | infDivCssClass: * |
public | initialized: boolean |
public | isExternalFlt: * |
public | isSortNumAsc: * |
public | isSortNumDesc: * |
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 | nbCells: * |
public | nbFilterableRows: * |
public | nbHiddenRows: number |
public | nbRows: * |
public | nbVisibleRows: number |
public | nmOperator: * |
public | noResults: * No results feature ** |
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 | 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: * cookies ** |
public | rememberPageLen: * |
public | rememberPageNb: * |
public | rgxOperator: * Filter operators ** |
public | rowsCounter: * rows counter ** |
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 | clearActiveColumns() Clears filtered columns visual indicator (background color) |
public | clearFilters() Clear all the filters' values |
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() Filter the table by retrieving the data from each cell in every single row and comparing it to the search term for current column. |
public | getCellData(cell: DOMElement): 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, includeHeaders: Boolean, num: Boolean, exclude: Array): Array Return the data of a specified column |
public | getCustomOptions(colIndex: Number): Array Returns an array [[value0, value1 ...],[text0, text1 ...]] with the custom options values and texts |
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, excludeHiddenCols: Boolean): Array Return the filtered data with following format: [ [rowIndex, [value0, value1...]], [rowIndex, [value0, value1...]] ] |
public | getFilteredDataCol(colIndex: Number, includeHeaders: Boolean): 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 | getHeadersText(excludeHiddenCols: Boolean): Array Return the list of headers' text |
public | getLastRowIndex(): Number Get the index of the last row |
public | getRowDisplay(row: 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 defined |
public | getStartRowIndex(): Number Get the row index from where the filtering process start (1st filterable row) |
public | getStylesheet(name: string): DOMElement Return stylesheet DOM element for a given theme name |
public | getTableData(includeHeaders: Boolean, excludeHiddenCols: Boolean): Array Return the table data with following format: [ [rowIndex, [value0, value1...]], [rowIndex, [value0, value1...]] ] |
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 features 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', 'checklist' type) |
public | loadExtension(ext: Object) Load an extension module |
public | loadThemes() Load themes defined in the configuration object |
public | markActiveColumn(colIndex: Number) Mark currently filtered column |
public | removeExternalFlts() Remove all the external column filters |
public | removeToolbar() Remove toolbar container element |
public | resetFilterValues() Reset persisted filter values |
public | setColWidths(tbl: Element) Set them columns' widths as per configuration |
public | setFilterValue(index: Number, query: String or Array) 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 alternateRows: * 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 emitter: * 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 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 hasPersistence: * source

### public hasThemes: * source

### public hasVisibleRows: * source

### public headersRow: * source

### public help: * source

### public highlightKeywords: * source

keyword highlighting **

### public id: * source

### public infDiv: * source

### public infDivCssClass: * source

### public initialized: boolean source

### public isExternalFlt: * source

### public isSortNumAsc: * source

### public isSortNumDesc: * 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 nbCells: * source

### public nbFilterableRows: * source

### public nbHiddenRows: number source

### public nbRows: * source

### public nbVisibleRows: number source

### public nmOperator: * source

### public noResults: * source

No results feature **

### 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 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

cookies **

### public rememberPageLen: * source

### public rememberPageNb: * source

### public rgxOperator: * source

Filter operators **

### public rowsCounter: * source

rows counter **

### 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 clearActiveColumns() source

Clears filtered columns visual indicator (background color)

### public clearFilters() source

Clear all the filters' values

### 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

Filter the table by retrieving the data from each cell in every single row and comparing it to the search term for current column. A row is hidden when all the search terms are not found in inspected row.

### public getCellData(cell: DOMElement): String source

Return the data of a given cell

#### Params:

Name | Type | Attribute | Description
cell | DOMElement |  | 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, includeHeaders: Boolean, num: Boolean, exclude: Array): Array source

Return the data of a specified column

#### Params:

Name | Type | Attribute | Description
colIndex | Number |  | Column index
includeHeaders | Boolean |  | Optional: include headers row
num | Boolean |  | Optional: return unformatted number
exclude | Array |  | Optional: 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, excludeHiddenCols: Boolean): Array source

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

#### Params:

Name | Type | Attribute | Description
includeHeaders | Boolean |  | Optional: include headers row
excludeHiddenCols | Boolean |  | Optional: exclude hidden columns

#### Return:

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

### public getFilteredDataCol(colIndex: Number, includeHeaders: Boolean): Array source

Return the filtered data for a given column index

#### Params:

Name | Type | Attribute | Description
colIndex | Number |  | Colmun's index
includeHeaders | Boolean |  | Optional: include headers row

#### 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 getHeadersText(excludeHiddenCols: Boolean): Array source

Return the list of headers' text

#### Params:

Name | Type | Attribute | Description
excludeHiddenCols | Boolean |  | Optional: exclude hidden columns

#### Return:

Array | list of headers' text

### public getLastRowIndex(): Number source

Get the index of the last row

#### Return:

Number

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

Get the display value of a row

#### Params:

Name | Type | Attribute | Description
row | RowElement |  | DOM 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, excludeHiddenCols: Boolean): Array source

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

#### Params:

Name | Type | Attribute | Description
includeHeaders | Boolean |  | Optional: include headers row
excludeHiddenCols | Boolean |  | Optional: exclude hidden columns

#### 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 features and layout

### 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

Load themes defined in the configuration object

### public markActiveColumn(colIndex: Number) source

Mark currently filtered column

#### Params:

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

### public removeExternalFlts() source

Remove all the external column filters

### public removeToolbar() source

Remove toolbar container element

### public resetFilterValues() source

Reset persisted filter values

### public setColWidths(tbl: Element) source

Set them columns' widths as per configuration

#### Params:

Name | Type | Attribute | Description
tbl | Element |  | DOM element

### public setFilterValue(index: Number, query: String or Array) source

Set search value to a given filter

#### Params:

Name | Type | Attribute | Description
index | Number |  | Column's index
query | String or Array |  | searcharg 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 |  |