Column Filters Technical Reference
Summary
- The Column Filter Applied Event fires whenever a Column Filter is applied in AdapTable
- Column Filter API Section of Adaptable API contains functions that manage AdapTable Column Filters
- Column Filter Options provide many functions to run Column Filters
- AdapTable supplies a large number of System Predicates that can be used in Column Filters
Column Filter State
There is no separate Column Filter State section in Initial Adaptable State.
Instead Column Filters are defined as a property of a Layout as part of Layout Initial State.
Filter Options
There are many filtering options in Filter Options section of AdapTable Options.
| Property | Description | Default |
|---|---|---|
| clearFiltersOnStartUp | Clear Grid and Column Filters when AdapTable loads | true |
| columnFilterOptions | Options for managing Column Filters | |
| customInFilterValues | Provide custom values (or sorting / count info) when using In Predicate in Column or Grid Filter | |
| enableFilterOnSpecialColumns | Allow filtering on Calculated & FreeText columns | true |
| filterActionOnDataChange | When to re-filter grid after data changes: 'Always', 'Never' or 'Throttle' (with a delay value) | 'Always' |
| gridFilterOptions | Options for managing the Grid Filter | |
| isRowFilterable | Configures whether Rows will be evaluated when filtering | |
| showDatePicker | Show Date Picker (or Date Input) in Filter controls | true |
| useAdaptableFiltering | Use Adaptable's Column & Grid Filters in preference to AG Grid's filtering | true |
Column Filter Options
This includes a dedicated Column Filter Options section to enable full configuration of Column Filters.
| Property | Description | Default |
|---|---|---|
| defaultArrayColumnFilter | Default filter type for array Columns ('textArray', 'numberArray', etc.) | In |
| defaultDateColumnFilter | Default filter type for date Columns | On |
| defaultNumericColumnFilter | Default filter type for numeric Columns | Equals |
| defaultTextColumnFilter | Default filter type for text Columns | Contains |
| hideQuickFilterDropdown | Hides Dropdown in Quick Filter Bar for a given Column | undefined |
| hideQuickFilterInput | Hides Input in Quick Filter Bar for a given Column | undefined |
| indicateFilteredColumns | Make Column Header distinctive for filtered columns, helps users see currently filtered columns | true |
| manuallyApplyColumnFilter | Manually apply Column Filters; an Apply Filter button is displayed and Quick Filter is disabled | false |
| quickFilterDebounce | Time to wait (in ms) before Filter Bar reacts to new value | 250 |
| quickFilterHeight | Height of Quick Filter Bar (if not provided, AG Grid default is used) | null |
| quickFilterWildcards | Shortcut Keys to activate a Quick Filter Predicate | |
| showQuickFilter | Display Quick Filter Bar between Column Header and Grid (provided its been setup) | true |
Column Filter API
The Column Filter API section of AdapTable API / FilterAPI enables Column Filters to be accessed, created, edited, deleted, suspended and shared programmatically:
| Method | Description |
|---|---|
| addBlanksToInFilterValues(columnDistinctValues) | Adds the Blanks Predicate if any value is null, undefined or an empty string |
| clearAndSetColumnFilters(columnFilters) | Clears existing Column Filters and sets new ones |
| clearColumnFilter(columnFilter) | Clears given Column Filter in the current Layout |
| clearColumnFilterForColumn(columnId) | Clears Column Filter for given Column |
| clearColumnFilters() | Clears all Column Filters in the Current Layout |
| clearColumnFiltersForColumns(columns) | Clears Column Filters for given set of Columns |
| columnFiltersToString(columnFilters) | Retrieves descriptions of given Column Filters |
| columnFilterToString(columnFilter) | Retrieves description of given Column Filter |
| getActiveColumnFilters() | Retrieves all active/no-suspended Column Filters in currently applied Layout |
| getColumnFilterDefs() | Retrieves the Column Filter definitions for all available Column Filters |
| getColumnFilterForColumn(columnId) | Retrieves the Column Filter for the specified Column. |
| getColumnFilters() | Retrieves all Column Filters in currently applied Layout |
| getColumnFiltersForLayout(layoutName) | Retrieves all Column Filters in a given Layout |
| getFilterPredicateDefsForColumn(column) | Gets all Filter Predicates available for a given Column |
| getFilterPredicateDefsForColumnId(columnId) | Gets all Filter Predicates available for a given ColumnId |
| hideQuickFilterBar() | Hides Quick Filter bar |
| isColumnFilterActive(columnFilter) | Checks if a Column Filter is active (i.e. Predicate has no inputs or has inputs with values) |
| isColumnFilterActiveForColumn(columnId) | Checks if the given Coumn has an active Column Filter |
| isQuickFilterAvailable() | Whether Quick Filter is available for use |
| isQuickFilterVisible() | Whether Quick Filter Form is currently visible |
| refreshAllFilterValues() | Refreshes (reloads) the filter values for ALL Columns (for IN Filter). |
| refreshFilterValues(columnId) | Refresh(reload) the filter values for a given Column (for IN Filter). |
| resetAllFilterValues() | Reset(clear cache) the filter values for ALL Columns (for IN Filter). |
| resetFilterValues(columnId) | Reset(clear cache) the filter values for a given Column (for IN Filter). |
| setColumnFilterForColumn(columnId, predicate) | Sets the Column Filter for a given Column (clears any existing) |
| setColumnFilters(columnFilters) | Sets Column Filters in current Layout; replaces filters for existing column, leaving other column filters in place |
| showQuickFilterBar() | Makes Quick Filter Bar appear |
| suspendAllColumnFilters() | Suspends all Column Filters |
| suspendColumnFilter(columnFilter) | Suspends a Column Filter |
| unSuspendAllColumnFilters() | Unsuspend all Column Filters |
| unSuspendColumnFilter(columnFilter) | Unsuspend a Column Filter |
Column Filter Applied Event
The Column Filter Applied Event is triggered whenever a Column Filter is applied in AdapTable.
Hint
This is often used when wanting to evaluate expressions on the Server
ColumnFilterAppliedInfo
The Event's columnfilterappliedinfo object contains a collection of currently applied Column Filters:
| Property | Description |
|---|---|
| columnFilters | Currently applied Column Filters |
| adaptableContext | Custom application Context provided in AdaptableOptions.adaptableContext |
Event Subscription
Subscribing to the Event is done the same way as with all Adaptable Events:
api.eventApi.on('ColumnFilterApplied', (eventInfo: ColumnFilterAppliedInfo) => {
// do something with the info
});System Filter Predicates
AdapTable provides a large number of Predicates - which are available for both developers and end users.
Hint
- Additionally, developers can include Custom Predicate Definitions to augment the System Filters
- Alternatively they can override the default System Predicates with custom behavior as needed
Most System Predicates are available for use when creating Column Filters.
The full list (including the Column Data Type they operate on, and the number of Inputs they accept) is:
| Predicate | Column Data Type | Number of Inputs |
|---|---|---|
Blanks | (All) | 0 |
NonBlanks | (All) | 0 |
In | (All) | n |
NotIn | (All) | n |
Equals | number | 1 |
NotEquals | number | 1 |
GreaterThan | number | 1 |
LessThan | number | 1 |
Positive | number | 0 |
Negative | number | 0 |
Zero | number | 0 |
NotBetween | number | 2 |
Is | text | 1 |
IsNot | text | 1 |
Contains | text | 1 |
NotContains | text | 1 |
StartsWith | text | 1 |
EndsWith | text | 1 |
Regex | text | 1 |
Today | date | 0 |
Yesterday | date | 0 |
Tomorrow | date | 0 |
ThisWeek | date | 0 |
ThisMonth | date | 0 |
ThisQuarter | date | 0 |
ThisYear | date | 0 |
InPast | date | 0 |
InFuture | date | 0 |
Before | date | 1 |
After | date | 1 |
On | date | 1 |
NotOn | date | 1 |
NextWorkDay | date | 0 |
LastWorkDay | date | 0 |
WorkDay | date | 0 |
Holiday | date | 0 |
Range | date | 2 |
True | boolean | 0 |
False | boolean | 0 |