Configuring Column Filters
Summary
- Column Filtering in AdapTable includes advanced features for more demanding use cases
- These are primarily available in Column Filter Options and allow developers to configure Filtering as needed
AdapTable provides many configuration options which allow developers to set up Column Filtering to meet precise requirements.
Most of these are available in the Column Filter Options section of Adaptable Options.
Find Out More
- This page lists some general Column Filtering options
- See Filter Components and In Filter for options to configure those UI Filter Components
Using AG Grid Filtering
By default AdapTable provides its own Filter controls instead of those provided by AG Grid.
Note
This is the only place in AdapTable where it provides alternative, rather than complementary, functionality
We do this because we think that AdapTable offers a richer, more intuitive and more configurable set of Filters.
AdapTable provides Filters in Layouts meaning you can save,and easily switch between, different Filter sets.
Hint
- An additional benefit is that AdapTable allows users to access Grid Filter and Column Filters simultaneously
- This is not possible using the AG Grid equivalents, where you need to choose between them
In the rare use case where AG Grid's filters are preferred, they can easily be turned on by setting useAdaptableFiltering to false in Filter Options.
Note
- This does not remove AdapTable Filtering logic, e.g the API functions will all stil operate
- However it does hide all AdapTable Filtering UI controls so they cannot be accessed accidentally
useAdaptableFiltering
Default: trueboolean- In this example we have turned off AdapTable Filtering (and use AG Grid's instead)
- As a reuslt we see AG Grid filters in the Filter Bar, Filter Form and Filter ToolPanel
- Additionally Column Filters and Grid Filter are absent from the Layout and all Adaptable Filtering controls (toolpanels, toolbars etc) are missing
Non Filterable Rows
By default all data rows in AdapTable will be evaluated in Column Filtering.
Occasionally, the use case arises where some rows should always be present and never subject to filtering.
This can be configured using the isRowFilterable property in Column Filter Options.
isRowFilterable
Default: trueboolean- In this example we provide an implementation for
isRowFilterableproperty, so these rows are never filtered:- the first row in the Grid
- any row where
Languageis 'HTML'
- We filter the
Languagecolumn on 'TypeScript' but still see "JavaScript" for theLanguagecolumn in first row, and see 'HTML' as those rows are excluded from filtering
Non Filterable Rows
Filtering on Special Columns
By default, AdapTable allows all Calculated Columns and FreeText Columns to be filterable.
This behaviour can be changed via the enableFilterOnSpecialColumns property in Filter Options.
enableFilterOnSpecialColumns
Default: truebooleanClearing Column Filters on Startup
AdapTable always saves previously applied Column Filters (and the Grid Filter) into AdapTable State (via the Current Layout).
It will then automatically re-apply these Filters when the Application is reloaded.
If this behaviour is not desired, set the clearFiltersOnStartUp property in Filter Options to true.
clearFiltersOnStartUp
Default: falsebooleanFiltering when Data Changes
By default AdapTable automatically and immediately re-applies all Filters whenever data changes in AG Grid.
Note
This includes both types of data changes - User Edit or Underlying Data Ticking.
Developers can amend this behaviour via the filterActionOnDataChange property in Filter Options.
Automatic re-filtering can be turned off altogether, or a Throttle can be applied.
Caution
- AG Grid automatically re-applies filters (effectively bypassing this property) if the Grid data is updated using:
applyTransactionin AG Grid's GridAPIupdateDataormanageGridDatain Adaptable GridAPI
Indicating Filtered Columns
AdapTable distinctively renders the Column Header for any currently filtered columns.
Note
This is particularly helpful when users restart the application, unaware that filters were persisted
If this is not desired behaviour, set the indicateFilteredColumns property to false.
Caution
- AG Grid will still indicate filtered Columns by providing a different filter icon in the Column Header
- You will need to change the AG Grid css to handle this
indicateFilteredColumns
Default: truebooleanColumn Filter Applied Event
AdapTable will fire the Column Filter Applied Event whenever a Column Filter changes.
This allows you to listen to Column Filters which have changed in AdapTable and react accordingly.
Hint
This is often used when wanting to evaluate expressions on the Server
- In this example we listen to the Column Filter Applied Event and output the Event's info to the console
- Create a Column Filter and inspect the Console to see the output from the Event