Defining Column Filters
Summary
- Column Filters are defined inside a Layout
- They can be defined in both Table and Pivot Layouts
Column Filters can be provided at design-time in given Layouts via Layout Initial State.
Each Column Filter is an AdapTableQL Expression - from a simple comparison to a function-based rule.
Find Out More
- See Defining Table Layouts for details on defining Column Filters in Layouts
- The AdapTableQL Expression Guide covers the functions and syntax available for writing Filter Expressions
Developer Guide
Defining Columns Filters in a Layout
Column Filters are provided in a Layout as follows:
// Provide 3 Column Filters
// a. IN on currency Column for 'USD' and 'EUR'
// b. Greater than on price Column
// c. Date comparison on orderDate Column
const initialState: InitialState = {
Layout: {
CurrentLayout: 'Filtered Layout',
Layouts: [
{
Name: 'Filtered Layout',
TableColumns: ['currency', 'orderDate', 'github_watchers', 'price'],
ColumnFilters: [
{
ColumnId: 'currency',
Expression: '[currency] IN ("USD", "EUR")',
},
{
ColumnId: 'price',
Expression: '[price] > 500',
},
{
ColumnId: 'orderDate',
Expression: '[orderDate] > DATE("2019-09-21")',
},
],
},
],
},
};1
Provide a ColumnFilters section
Create a ColumnFilters property inside a Layout
This is an array with one item for each Column Filter to be provided
2
Provide Column Id
Supply the ColumnId for each Filter.
3
Provide Expression
Create an Expression for each Filter.
This is an AdapTableQL Expression boolean expression evaluated for each row.
It can be anything from a simple comparison to a function-based rule (e.g. a date comparison).