Home Reference Source
import {TableFilter} from 'tablefilter/src/tablefilter.js'
public class | source

TableFilter

Makes HTML tables filterable and a bit more :)

Constructor Summary

Public Constructor
public

constructor(table: HTMLTableElement, id: String, row: Number, configuration: Object)

Creates an instance of TableFilter requires table or id arguments, row and configuration optional

Member Summary

Public Members
public

Enable/disable alternating rows

public

Logical AND operator for input filter.

public

Enable auto-filter behaviour, table is filtered when a user stops typing

public

Auto-filter delay in milliseconds

public

Base path for static assets

public

Css class for filters submission button

public

Enable clear button

public

Define filters submission button text

public

Enable/disable case sensitivity for filtering, default false

public

Specify which column implements a custom cell parser to retrieve the cell value: cell_parser: { cols: [0, 2], parse: function(tf, cell, colIndex) { // custom cell parser logic here return cellValue; } }

public

Text for clear option in drop-down filter types (1st option)

public

Define data types on a column basis, possible values 'string', 'number', 'formatted-number', 'date', 'ipaddress' ie: col_types : [ 'string', 'date', 'number', { type: 'formatted-number', decimal: ',', thousands: '.' }, { type: 'date', locale: 'en-gb' }, { type: 'date', format: ['{dd}-{months}-{yyyy|yy}'] } ]

public

Columns widths array

public

Custom options definition of a per column basis, ie: custom_options: { cols:[0, 1], texts: [ ['a0', 'b0', 'c0'], ['a1', 'b1', 'c1'] ], values: [ ['a0', 'b0', 'c0'], ['a1', 'b1', 'c1'] ], sorts: [false, true] }

public

Define decimal separator ',' or '.', defaults to '.'

public

Default column width when column widths are defined

public

Inequality operator for input filter.

public

Enable/disable readonly state for excluded options when linked filters filtering mode is on

public

Enable filters submission button

public

Empty cells operator for input filter.

public

Event emitter instance

public

Text for empty option in drop-down filter types

public

Ends with operator for input filter.

public

Enable default theme

public

Indicate whether empty option is enabled in drop-down filter types

public

Enable/disable icons (paging, reset button)

public

Indicate whether non-empty option is enabled in drop-down filter types

public

Enable/disable enter key for input type filters

public

Strict equality operator for input filter.

public

Globally enable/disable exact match filtering

public

Exact match filtering per column array

public

List of row indexes to be excluded from filtering

public

List of loaded extensions

public

List of containers IDs where external filters will be generated

public

Filters row index

public

Define the type of cell containing a filter (td/th)

public

Css class for a filter element

public

Enable/disable filters

public

Css class for multiple select filters

public

Css class for small filter (when submit button is active)

public

Css class for the filters row

public

Greater than or equal operator for input filter.

public

Greater than operator for input filter.

public

Enable/disable grid layout (fixed headers)

public

Indicate whether custom drop-down filter options are implemented

public

Indicate whether help UI component is disabled

public

Enable keyword highlighting behaviour

public

Ignore diacritics globally or on a column basis

public

Lower than or equal operator for input filter.

public

Enable/disable linked filters filtering mode

public

Like operator for input filter.

public

Indicate whether drop-down filter types are populated on demand at first usage

public

Enable activity/spinner indicator UI component

public

Define default locale, default to 'en' as per Sugar Date module: https://sugarjs.com/docs/#/DateLocales

public

Lower than operator for input filter.

public

Indicate whether filtered (active) columns indicator is enabled

public

Non-empty cells operator for input filter.

public

Enable no results message UI component

public

Text for non-empty option in drop-down filter types

public

Callback fired after filtering process is completed

public

Callback fired after filters are cleared

public

Callback fired before filtering process starts

public

Callback fired before filters are cleared

public

Callback fired after filters are generated

public

Callback fired after a row is validated during filtering

public

Indicate whether drop-down filter types filter the table by default on change event

public

Logical OR operator for input filter.

public

Enable paging component

public

Indicate whether pop-up filters UI is enabled

public

Calculated row's index from which starts filtering once filters are generated

public

Enable responsive layout

public

Regular expression operator for input filter.

public

Enable rows counter UI component

public

Stored values separator

public

Enable/disable single filter mode

public

Css class for single filter type

public

Specify columns to be excluded from single filter search, by default searching in all columns: single_filter: { exclude_cols: [2, 7] }

public

List of columns implementing filter options sorting in ascending manner based on column data type

public

List of columns implementing filter options sorting in descending manner based on column data type

public

Make drop-down filter types options sorted in alpha-numeric manner by default globally or on a column basis

public

Starts with operator for input filter.

public

Enable state persistence

public

Enable status bar UI component

public

Enable sticky headers

public

Path for stylesheets

public

Main stylesheet path

public

List of themes, ie: themes: [{ name: 'skyblue' }]

public

Define path to themes assets, defaults to 'tablefilter/style/themes/'.

public

Define thousands separator ',' or '.', defaults to ','

public

Enable toolbar component

public

Current version

public

Global watermark text for input filter type or watermark for each filter if an array is supplied

Method Summary

Public Methods
public

activateFilter(colIndex: *)

Make specified column's filter active

public

Clear all the filters' values

public

Get the configuration object (literal object)

public

Destroy filter grid

public

Destroy all the extensions store in extensions registry

public

detectKey(evt: Event)

Detect <enter> key

public

dom(): HTMLTableElement

Return the working DOM element

public

eachCol(fn: Function, continueFn: Function, breakFn: Function)

Column iterator invoking continue and break condition callbacks if any then calling supplied callback for each item

public

eachRow(startIdx: Number): *

Rows iterator starting from supplied row index or defaulting to reference row index.

public

Get an extension instance

public

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

Return the ID of the current active filter

public

getCellData(cell: DOMElement): String | Number | Date

Return the typed data of a given cell based on the column type definition

public

getCellValue(Cell's: DOMElement): String

Return the text content of a given cell

public

getCellsNb(rowIndex: Number): Number

Return the number of cells for a given row index

public

Return clear all text for specified filter column

public

getColumnData(colIndex: Number, includeHeaders: Boolean, exclude: Array): *

Return the data of a specified column

public

Return the column index for a given filter ID

public

getColumnValues(colIndex: Number, includeHeaders: Boolean, exclude: Array): *

Return the values of a specified column

public

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

public

getData(includeHeaders: Boolean, excludeHiddenCols: Boolean): Array

Return the table data based on its columns data type definitions with following structure: [ [rowIndex, [data0, data1...]], [rowIndex, [data0, data1...]] ]

public

getDecimal(colIndex: Number): String

Return the decimal separator for supplied column as per column type configuration or global setting

public

getFilterElement(index: Number): DOMElement

Return the filter's DOM element for a given column

public

Return the ID of a specified column's filter

public

Return the filter type for a specified column

public

Return the filter's value of a specified column

public

Get the total number of filterable rows

public

getFilteredColumnData(colIndex: any, includeHeaders: boolean, exclude: any): Array

Return the filtered data for a given column index

public

getFilteredColumnValues(colIndex: any, includeHeaders: boolean, exclude: any): Array

Return the filtered values for a given column index

public

getFilteredData(includeHeaders: Boolean, excludeHiddenCols: Boolean): Array

Return the filtered table data based on its columns data type definitions with following structure: [ [rowIndex, [data0, data1...]], [rowIndex, [data0, data1...]] ]

public

getFilteredValues(includeHeaders: Boolean, excludeHiddenCols: Boolean): Array

Return the filtered table values with following structure: [ [rowIndex, [value0, value1...]], [rowIndex, [value0, value1...]] ]

public

getFiltersByType(type: String, bool: Boolean): [type]

Return the list of ids of filters matching a specified type.

public

Get list of filter IDs

public

Get the index of the row containing the filters

public

Return the filters' values

public

getHeaderElement(colIndex: Number): Element

Get the header DOM element for a given column index

public

Get the index of the headers row

public

getHeadersText(excludeHiddenCols: Boolean): Array

Return the list of headers' text

public

Get the index of the last row

public

getRowDisplay(row: HTMLTableRowElement): String

Get the display value of a row

public

getRowsNb(includeHeaders: Boolean): Number

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

public

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

Get filtered (valid) rows indexes

public

Return the total number of valid rows

public

getValues(includeHeaders: Boolean, excludeHiddenCols: Boolean): Array

Return the table values with following structure: [ [rowIndex, [value0, value1...]], [rowIndex, [value0, value1...]] ]

public

getVisibleColumnData(colIndex: any, includeHeaders: boolean, exclude: any): Array

Return the filtered and visible data for a given column index

public

getVisibleColumnValues(colIndex: any, includeHeaders: boolean, exclude: any): Array

Return the filtered and visible values for a given column index

public

Return the collection of the working rows, that is, the rows belonging to the tbody section(s)

public

Check passed extension name exists

public

hasType(colIndex: Number, types: Array): Boolean

Determine whether the specified column has one of the passed types

public

Check if specified column filter ignores diacritics.

public

import(fileId: String, filePath: String, callback: Function, type: String)

Import script or stylesheet

public

init()

Initialise features and layout

public

Initialise all the extensions defined in the configuration object

public

Check if given column implements a filter with custom options

public

Determine 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

Check if table has filters grid

public

Check if passed row is visible

public

isRowValid(rowIndex: Number): Boolean

Check if passed row is valid

public

Load an extension module

public

Load themes defined in the configuration object

public

Filter's blur event: if auto-filter on, clear interval on filter blur

public

onInpFocus(evt: Event)

Filter's focus event

public

Filter's keydown event: if auto-filter on, detect user is typing

public

onKeyUp(evt: Event)

Filter's keyup event: if auto-filter on, detect user is typing and filter columns

public

Register the passed extension instance with associated name

public

Remove all the external column filters

public

Set the ID of the current active filter

public

setColWidths(tbl: TableElement)

Set passed or default working table columns' widths with configuration values

public

Exclude rows from actions

public

setFilterValue(index: Number, query: String or Array)

Set search value to a given filter

public

setFixedLayout(tbl: TableElement)

Make passed or default working table element width fixed

public

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: HTMLTableElement, id: String, row: Number, configuration: Object) source

Creates an instance of TableFilter requires table or id arguments, row and configuration optional

Params:

NameTypeAttributeDescription
table HTMLTableElement

Table DOM element

id String

Table id

row Number

index indicating the 1st row

configuration Object

object

Public Members

public alternateRows: Boolean source

Enable/disable alternating rows

public anOperator: String source

Logical AND operator for input filter. Defaults to '&&'

public autoFilter: Object | Boolean source

Enable auto-filter behaviour, table is filtered when a user stops typing

public autoFilterDelay: Number source

Auto-filter delay in milliseconds

public basePath: String source

Base path for static assets

public btnCssClass: String source

Css class for filters submission button

public btnReset: Object | Boolean source

Enable clear button

public btnText: String source

Define filters submission button text

public caseSensitive: Boolean source

Enable/disable case sensitivity for filtering, default false

public cellParser: Object source

Specify which column implements a custom cell parser to retrieve the cell value: cell_parser: { cols: [0, 2], parse: function(tf, cell, colIndex) { // custom cell parser logic here return cellValue; } }

public clearFilterText: String | Array source

Text for clear option in drop-down filter types (1st option)

public colTypes: Array source

Define data types on a column basis, possible values 'string', 'number', 'formatted-number', 'date', 'ipaddress' ie: col_types : [ 'string', 'date', 'number', { type: 'formatted-number', decimal: ',', thousands: '.' }, { type: 'date', locale: 'en-gb' }, { type: 'date', format: ['{dd}-{months}-{yyyy|yy}'] } ]

Refer to https://sugarjs.com/docs/#/DateParsing for exhaustive information on date parsing formats supported by Sugar Date

public colWidths: Array source

Columns widths array

public customOptions: Object source

Custom options definition of a per column basis, ie: custom_options: { cols:[0, 1], texts: [ ['a0', 'b0', 'c0'], ['a1', 'b1', 'c1'] ], values: [ ['a0', 'b0', 'c0'], ['a1', 'b1', 'c1'] ], sorts: [false, true] }

public decimalSeparator: String source

Define decimal separator ',' or '.', defaults to '.'

public defaultColWidth: * source

Default column width when column widths are defined

public dfOperator: String source

Inequality operator for input filter. Defaults to '!'

public disableExcludedOptions: Boolean source

Enable/disable readonly state for excluded options when linked filters filtering mode is on

public displayBtn: Boolean source

Enable filters submission button

public emOperator: String source

Empty cells operator for input filter. Defaults to '[empty]'

public emitter: Emitter source

Event emitter instance

public emptyText: String source

Text for empty option in drop-down filter types

public enOperator: String source

Ends with operator for input filter. Defaults to '='

public enableDefaultTheme: Boolean source

Enable default theme

public enableEmptyOption: Boolean source

Indicate whether empty option is enabled in drop-down filter types

public enableIcons: Boolean source

Enable/disable icons (paging, reset button)

public enableNonEmptyOption: Boolean source

Indicate whether non-empty option is enabled in drop-down filter types

public enterKey: Boolean source

Enable/disable enter key for input type filters

public eqOperator: String source

Strict equality operator for input filter. Defaults to '='

public exactMatch: Boolean source

Globally enable/disable exact match filtering

public exactMatchByCol: Array source

Exact match filtering per column array

public excludeRows: Array source

List of row indexes to be excluded from filtering

public extensions: Array source

List of loaded extensions

public externalFltIds: Array source

List of containers IDs where external filters will be generated

public filtersRowIndex: Number source

Filters row index

public fltCellTag: String source

Define the type of cell containing a filter (td/th)

public fltCssClass: String source

Css class for a filter element

public fltGrid: Boolean source

Enable/disable filters

public fltMultiCssClass: String source

Css class for multiple select filters

public fltSmallCssClass: String source

Css class for small filter (when submit button is active)

public fltsRowCssClass: String source

Css class for the filters row

public geOperator: String source

Greater than or equal operator for input filter. Defaults to '>='

public grOperator: String source

Greater than operator for input filter. Defaults to '>'

public gridLayout: Object | Boolean source

Enable/disable grid layout (fixed headers)

public hasCustomOptions: Boolean source

Indicate whether custom drop-down filter options are implemented

public help: Boolean source

Indicate whether help UI component is disabled

public highlightKeywords: Boolean source

Enable keyword highlighting behaviour

public ignoreDiacritics: Boolean | Array source

Ignore diacritics globally or on a column basis

public leOperator: String source

Lower than or equal operator for input filter. Defaults to '<='

public linkedFilters: Boolean source

Enable/disable linked filters filtering mode

public lkOperator: String source

Like operator for input filter. Defaults to '*'

public loadFltOnDemand: Boolean source

Indicate whether drop-down filter types are populated on demand at first usage

public loader: Boolean | Object source

Enable activity/spinner indicator UI component

public locale: String source

Define default locale, default to 'en' as per Sugar Date module: https://sugarjs.com/docs/#/DateLocales

public lwOperator: String source

Lower than operator for input filter. Defaults to '<'

public markActiveColumns: Boolean source

Indicate whether filtered (active) columns indicator is enabled

public nmOperator: String source

Non-empty cells operator for input filter. Defaults to '[nonempty]'

public noResults: Object | Boolean source

Enable no results message UI component

public nonEmptyText: String source

Text for non-empty option in drop-down filter types

public onAfterFilter: Function source

Callback fired after filtering process is completed

public onAfterReset: Function source

Callback fired after filters are cleared

public onBeforeFilter: Function source

Callback fired before filtering process starts

public onBeforeReset: Function source

Callback fired before filters are cleared

public onFiltersLoaded: Function source

Callback fired after filters are generated

public onRowValidated: Function source

Callback fired after a row is validated during filtering

public onSlcChange: Boolean source

Indicate whether drop-down filter types filter the table by default on change event

public orOperator: String source

Logical OR operator for input filter. Defaults to '||'

public paging: Object | Boolean source

Enable paging component

public popupFilters: Boolean | Object source

Indicate whether pop-up filters UI is enabled

public refRow: Number source

Calculated row's index from which starts filtering once filters are generated

public responsive: Boolean source

Enable responsive layout

public rgxOperator: String source

Regular expression operator for input filter. Defaults to 'rgx:'

public rowsCounter: Boolean | Object source

Enable rows counter UI component

public separator: String source

Stored values separator

public singleFlt: Boolean | Object source

Enable/disable single filter mode

public singleFltCssClass: String source

Css class for single filter type

public singleFltExcludeCols: * source

Specify columns to be excluded from single filter search, by default searching in all columns: single_filter: { exclude_cols: [2, 7] }

public sortFilterOptionsAsc: Array source

List of columns implementing filter options sorting in ascending manner based on column data type

public sortFilterOptionsDesc: Array source

List of columns implementing filter options sorting in descending manner based on column data type

public sortSlc: Boolean | Array source

Make drop-down filter types options sorted in alpha-numeric manner by default globally or on a column basis

public stOperator: String source

Starts with operator for input filter. Defaults to '='

public state: Object | Boolean source

Enable state persistence

public statusBar: Boolean | Object source

Enable status bar UI component

public stickyHeaders: Boolean source

Enable sticky headers

public stylePath: String source

Path for stylesheets

public stylesheet: String source

Main stylesheet path

public themes: Array source

List of themes, ie: themes: [{ name: 'skyblue' }]

public themesPath: Array source

Define path to themes assets, defaults to 'tablefilter/style/themes/'. Usage: themes: [{ name: 'skyblue' }]

public thousandsSeparator: String source

Define thousands separator ',' or '.', defaults to ','

public toolbar: Object | Boolean source

Enable toolbar component

public version: String source

Current version

public watermark: String | Array source

Global watermark text for input filter type or watermark for each filter if an array is supplied

Public Methods

public activateFilter(colIndex: *) source

Make specified column's filter active

Params:

NameTypeAttributeDescription
colIndex *

Index of a column

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 store in extensions registry

public detectKey(evt: Event) source

Detect <enter> key

Params:

NameTypeAttributeDescription
evt Event

public dom(): HTMLTableElement source

Return the working DOM element

Return:

HTMLTableElement

public eachCol(fn: Function, continueFn: Function, breakFn: Function) source

Column iterator invoking continue and break condition callbacks if any then calling supplied callback for each item

Params:

NameTypeAttributeDescription
fn Function
  • optional
  • default: EMPTY_FN

callback

continueFn Function
  • optional
  • default: EMPTY_FN

continue condition callback

breakFn Function
  • optional
  • default: EMPTY_FN

break condition callback

public eachRow(startIdx: Number): * source

Rows iterator starting from supplied row index or defaulting to reference row index. Closure function accepts a callback function and optional continue and break callbacks.

Params:

NameTypeAttributeDescription
startIdx Number

Row index from which filtering starts

Return:

*

public extension(name: String): Object source

Get an extension instance

Params:

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

NameTypeAttributeDescription
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 getActiveFilterId(): String source

Return the ID of the current active filter

Return:

String

public getCellData(cell: DOMElement): String | Number | Date source

Return the typed data of a given cell based on the column type definition

Params:

NameTypeAttributeDescription
cell DOMElement

Cell's DOM element

Return:

String | Number | Date

public getCellValue(Cell's: DOMElement): String source

Return the text content of a given cell

Params:

NameTypeAttributeDescription
Cell's DOMElement

DOM element

Return:

String

public getCellsNb(rowIndex: Number): Number source

Return the number of cells for a given row index

Params:

NameTypeAttributeDescription
rowIndex Number

Index of the row

Return:

Number

Number of cells

public getClearFilterText(colIndex: Number): String source

Return clear all text for specified filter column

Params:

NameTypeAttributeDescription
colIndex Number

Column index

Return:

String

public getColumnData(colIndex: Number, includeHeaders: Boolean, exclude: Array): * source

Return the data of a specified column

Params:

NameTypeAttributeDescription
colIndex Number

Column index

includeHeaders Boolean
  • optional
  • default: false

Include headers row

exclude Array
  • optional
  • default: []

List of row indexes to be excluded

Return:

*

Flat list of data for a column

public getColumnIndexFromFilterId(filterId: string): Number source

Return the column index for a given filter ID

Params:

NameTypeAttributeDescription
filterId string
  • optional
  • default: ''

Filter ID

Return:

Number

Column index

public getColumnValues(colIndex: Number, includeHeaders: Boolean, exclude: Array): * source

Return the values of a specified column

Params:

NameTypeAttributeDescription
colIndex Number

Column index

includeHeaders Boolean
  • optional
  • default: false

Include headers row

exclude Array
  • optional
  • default: []

List of row indexes to be excluded

Return:

*

Flat list of values for a column

public getCustomOptions(colIndex: Number): Array source

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

Params:

NameTypeAttributeDescription
colIndex Number

Column's index

Return:

Array

public getData(includeHeaders: Boolean, excludeHiddenCols: Boolean): Array source

Return the table data based on its columns data type definitions with following structure: [ [rowIndex, [data0, data1...]], [rowIndex, [data0, data1...]] ]

Params:

NameTypeAttributeDescription
includeHeaders Boolean
  • optional
  • default: false

Include headers row

excludeHiddenCols Boolean
  • optional
  • default: false

Exclude hidden columns

Return:

Array

public getDecimal(colIndex: Number): String source

Return the decimal separator for supplied column as per column type configuration or global setting

Params:

NameTypeAttributeDescription
colIndex Number

Column index

Return:

String

'.' or ','

public getFilterElement(index: Number): DOMElement source

Return the filter's DOM element for a given column

Params:

NameTypeAttributeDescription
index Number

Column's index

Return:

DOMElement

public getFilterId(index: Number): String source

Return the ID of a specified column's filter

Params:

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

NameTypeAttributeDescription
colIndex Number

Column's index

Return:

String

public getFilterValue(index: Number): String source

Return the filter's value of a specified column

Params:

NameTypeAttributeDescription
index Number

Column index

Return:

String

Filter value

public getFilterableRowsNb(): Number source

Get the total number of filterable rows

Return:

Number

public getFilteredColumnData(colIndex: any, includeHeaders: boolean, exclude: any): Array source

Return the filtered data for a given column index

Params:

NameTypeAttributeDescription
colIndex any

Colmun's index

includeHeaders boolean
  • optional
  • default: false

Optional Include headers row

exclude any
  • optional
  • default: []

Optional List of row indexes to be excluded

Return:

Array

Flat list of typed values [data0, data1, data2...]

TODO: provide an API returning data in JSON format

public getFilteredColumnValues(colIndex: any, includeHeaders: boolean, exclude: any): Array source

Return the filtered values for a given column index

Params:

NameTypeAttributeDescription
colIndex any

Colmun's index

includeHeaders boolean
  • optional
  • default: false

Optional Include headers row

exclude any
  • optional
  • default: []

Optional List of row indexes to be excluded

Return:

Array

Flat list of values ['value0', 'value1', 'value2'...]

TODO: provide an API returning data in JSON format

public getFilteredData(includeHeaders: Boolean, excludeHiddenCols: Boolean): Array source

Return the filtered table data based on its columns data type definitions with following structure: [ [rowIndex, [data0, data1...]], [rowIndex, [data0, data1...]] ]

Params:

NameTypeAttributeDescription
includeHeaders Boolean
  • optional
  • default: false

Include headers row

excludeHiddenCols Boolean
  • optional
  • default: false

Exclude hidden columns

Return:

Array

TODO: provide an API returning data in JSON format

public getFilteredValues(includeHeaders: Boolean, excludeHiddenCols: Boolean): Array source

Return the filtered table values with following structure: [ [rowIndex, [value0, value1...]], [rowIndex, [value0, value1...]] ]

Params:

NameTypeAttributeDescription
includeHeaders Boolean
  • optional
  • default: false

Include headers row

excludeHiddenCols Boolean
  • optional
  • default: false

Exclude hidden columns

Return:

Array

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:

NameTypeAttributeDescription
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(): Array source

Get list of filter IDs

Return:

Array

List of filters ids

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): Element source

Get the header DOM element for a given column index

Params:

NameTypeAttributeDescription
colIndex Number

Column index

Return:

Element

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:

NameTypeAttributeDescription
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: HTMLTableRowElement): String source

Get the display value of a row

Params:

NameTypeAttributeDescription
row HTMLTableRowElement

DOM element of the row

Return:

String

Usually 'none' or ''

public getRowsNb(includeHeaders: Boolean): Number source

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

Params:

NameTypeAttributeDescription
includeHeaders Boolean

Include the headers row(s)

Return:

Number

Number of working 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:

NameTypeAttributeDescription
name string
  • optional
  • default: default

Return:

DOMElement

stylesheet element

public getValidRows(reCalc: Boolean): Array source

Get filtered (valid) rows indexes

Params:

NameTypeAttributeDescription
reCalc Boolean

Force calculation of filtered rows list

Return:

Array

List of row indexes

public getValidRowsNb(reCalc: Boolean): Number source

Return the total number of valid rows

Params:

NameTypeAttributeDescription
reCalc Boolean
  • optional
  • default: false

Forces calculation of filtered rows

Return:

Number

public getValues(includeHeaders: Boolean, excludeHiddenCols: Boolean): Array source

Return the table values with following structure: [ [rowIndex, [value0, value1...]], [rowIndex, [value0, value1...]] ]

Params:

NameTypeAttributeDescription
includeHeaders Boolean
  • optional
  • default: false

Include headers row

excludeHiddenCols Boolean
  • optional
  • default: false

Exclude hidden columns

Return:

Array

public getVisibleColumnData(colIndex: any, includeHeaders: boolean, exclude: any): Array source

Return the filtered and visible data for a given column index

Params:

NameTypeAttributeDescription
colIndex any

Colmun's index

includeHeaders boolean
  • optional
  • default: false

Optional Include headers row

exclude any
  • optional
  • default: []

Optional List of row indexes to be excluded

Return:

Array

Flat list of typed values [data0, data1, data2...]

TODO: provide an API returning data in JSON format

public getVisibleColumnValues(colIndex: any, includeHeaders: boolean, exclude: any): Array source

Return the filtered and visible values for a given column index

Params:

NameTypeAttributeDescription
colIndex any

Colmun's index

includeHeaders boolean
  • optional
  • default: false

Optional Include headers row

exclude any
  • optional
  • default: []

Optional List of row indexes to be excluded

Return:

Array

Flat list of values ['value0', 'value1', 'value2'...]

TODO: provide an API returning data in JSON format

public getWorkingRows(): Array source

Return the collection of the working rows, that is, the rows belonging to the tbody section(s)

Return:

Array

public hasExtension(name: String): Boolean source

Check passed extension name exists

Params:

NameTypeAttributeDescription
name String

Name of the extension

Return:

Boolean

public hasType(colIndex: Number, types: Array): Boolean source

Determine whether the specified column has one of the passed types

Params:

NameTypeAttributeDescription
colIndex Number

Column index

types Array
  • optional
  • default: []

List of column types

Return:

Boolean

public ignoresDiacritics(colIndex: Number): Boolean source

Check if specified column filter ignores diacritics. Note this is only applicable to input filter types.

Params:

NameTypeAttributeDescription
colIndex Number

Column index

Return:

Boolean

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

Import script or stylesheet

Params:

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

NameTypeAttributeDescription
colIndex Number

Column's index

Return:

Boolean

public isExactMatch(colIndex: Number): Boolean source

Determine if passed filter column implements exact query match

Params:

NameTypeAttributeDescription
colIndex Number

Column index

Return:

Boolean

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

Check if passed script or stylesheet is already imported

Params:

NameTypeAttributeDescription
filePath String

Ressource path

type String

Possible values: 'script' or 'link'

Return:

Boolean

public isInitialized(): Boolean source

Check if table has filters grid

Return:

Boolean

public isRowDisplayed(rowIndex: Number): Boolean source

Check if passed row is visible

Params:

NameTypeAttributeDescription
rowIndex Number

Row index

Return:

Boolean

public isRowValid(rowIndex: Number): Boolean source

Check if passed row is valid

Params:

NameTypeAttributeDescription
rowIndex Number

Row index

Return:

Boolean

public loadExtension(ext: Object) source

Load an extension module

Params:

NameTypeAttributeDescription
ext Object

Extension config object

public loadThemes() source

Load themes defined in the configuration object

public onInpBlur() source

Filter's blur event: if auto-filter on, clear interval on filter blur

public onInpFocus(evt: Event) source

Filter's focus event

Params:

NameTypeAttributeDescription
evt Event

public onKeyDown() source

Filter's keydown event: if auto-filter on, detect user is typing

public onKeyUp(evt: Event) source

Filter's keyup event: if auto-filter on, detect user is typing and filter columns

Params:

NameTypeAttributeDescription
evt Event

public registerExtension(inst: Object, name: String) source

Register the passed extension instance with associated name

Params:

NameTypeAttributeDescription
inst Object

Extension instance

name String

Name of the extension

public removeExternalFlts() source

Remove all the external column filters

public setActiveFilterId(filterId: String) source

Set the ID of the current active filter

Params:

NameTypeAttributeDescription
filterId String

Element ID

public setColWidths(tbl: TableElement) source

Set passed or default working table columns' widths with configuration values

Params:

NameTypeAttributeDescription
tbl TableElement

optional table DOM element

public setExcludeRows() source

Exclude rows from actions

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

Set search value to a given filter

Params:

NameTypeAttributeDescription
index Number

Column's index

query String or Array

searcharg Search term

public setFixedLayout(tbl: TableElement) source

Make passed or default working table element width fixed

Params:

NameTypeAttributeDescription
tbl TableElement

optional table DOM element

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:

NameTypeAttributeDescription
rowIndex Number

Index of the row

isValid Boolean