System Filters

View as Markdown

Summary

  • Column Filters use boolean Expression Functions as operators (e.g. EQ, CONTAINS, IS_BLANK, IS_SAME_DAY)
  • Which operators appear for any given Column depends on its Data Type
  • Developers can control which Expression Functions are available - globally, per Module, or per Column
  • Additionally, Developers can set the default filter operator for each Column or Data Type

Every Column Filter operator is simply a boolean Expression Function applied to the filtered Column.

Filter Operators

When you open a Column Filter, AdapTable ensures that the operator dropdown lists the boolean Expression Functions that apply to that Column's Data Type.

Deep Dive

How Filters Become Expressions

Limiting Available Operators

By default every boolean Expression Function applicable to a Column's Data Type is offered.

To restrict this, use the isExpressionFunctionAvailable property in Expression Options.

isExpressionFunctionAvailable

Default: undefined
function
Control which Expression Functions are available (globally, per Module, or per Column)
System Filters
Fork
  • This demo uses isExpressionFunctionAvailable to limit the operators offered in each Column's Filter dropdown:
    • The Name Column offers only the CONTAINS, ENDS_WITH and REGEX operators
    • All other Columns offer whichever of CONTAINS, GT, EQ, IS_THIS_MONTH and IN are relevant to that Column's Data Type
Try It Out
  • Open the various filter dropdowns and see that there is a much reduced list of operators available
  • Open the Name dropdown and see that the list provided just for that Column is shown
Loading demo…

Default Filters

AdapTable sets a default filter operator to use for 4 Column Data Types.

However, each of these can be changed by using a relevant property in Column Filter Options:

Data TypeOptions PropertyDefaultAvailable Values
textdefaultTextColumnFilter CONTAINSEQ NEQ CONTAINS NOT_CONTAINS STARTS_WITH ENDS_WITH REGEX IN NOT_IN IS_BLANK IS_NOT_BLANK
numericdefaultNumericColumnFilterEQGT GTE LT LTE EQ NEQ IN NOT_IN IS_BLANK IS_NOT_BLANK
datedefaultDateColumnFilterIS_SAME_DAYEQ NEQ GT GTE LT LTE IS_SAME_DAY IS_DIFFERENT_DAY IN NOT_IN IS_BLANK IS_NOT_BLANK
arraydefaultArrayColumnFilterININ NOT_IN IS_BLANK IS_NOT_BLANK

Hint

It is also possible to set a different default filter operator to display in the Filter Bar and the Filter Form

Each property offers two types of return value:

  • a filter operator (relevant to the data type) directly
  • a function which receives an DefaultFilterExpressionContext object, and returns the filter operator

Note

This is particularly useful in the Filter Bar as it sets the filter operator that is displayed by default for the Column

Default Filters
Fork
  • This example sets the 4 different data-type related default filter operator properties:
    • defaultNumericColumnFilter - GT for Filter Bar and LT for Filter Form (provided hard-coded for both, so is same for all numeric columns)
    • defaultTextColumnFilter - STARTS_WITH for all string columns except Language which is IN
    • defaultDateColumnFilter - LT for Created and Updated columns, and GT for all other date columns
    • defaultArrayColumnFilter - NOT_IN (provided hard-coded so is same for all array columns)
Loading demo…

Default Text Filter

Use the defaultTextColumnFilter property to set the default filter operator for text columns.

defaultTextColumnFilter

Default: CONTAINS
EQ|NEQ|CONTAINS|NOT_CONTAINS|STARTS_WITH|ENDS_WITH|IN|NOT_IN|REGEX|IS_BLANK|IS_NOT_BLANK
Default filter operator to use for Text (string) Columns

Default Numeric Filter

Use the defaultNumericColumnFilter property to set the default filter operator for Numeric columns.

defaultNumericColumnFilter

Default: EQ
GT|GTE|LT|LTE|EQ|NEQ|IN|NOT_IN|IS_BLANK|IS_NOT_BLANK
Default filter operator to use for Numeric Columns

Default Date Filter

Use the defaultDateColumnFilter property to set the default filter for Date columns.

'IS_SAME_DAY' matches the same calendar day. Use 'EQ' when you need exact timestamp equality.

defaultDateColumnFilter

Default: IS_SAME_DAY
EQ|NEQ|GT|GTE|LT|LTE|IS_SAME_DAY|IS_DIFFERENT_DAY|IN|NOT_IN|IS_BLANK|IS_NOT_BLANK
Default filter operator to use for Date Columns

Default Array Filter

Use the defaultArrayColumnFilter property to set the default filter operator for Array (text and numeric) columns.

defaultArrayColumnFilter

Default: IN
IN|NOT_IN|IS_BLANK|IS_NOT_BLANK
Default filter operator to use for Array-based Columns

Appendix: System Filter List

The boolean functions used as filter operators, by Data Type, are broadly:

Text Columns
  • EQ, NEQ
  • CONTAINS, NOT_CONTAINS
  • STARTS_WITH, ENDS_WITH
  • REGEX
  • IN, NOT_IN
  • IS_BLANK, IS_NOT_BLANK
Numeric Columns
  • EQ, NEQ
  • GT, GTE, LT, LTE
  • IN, NOT_IN
  • IS_POSITIVE, IS_NEGATIVE
  • IS_BLANK, IS_NOT_BLANK
Date Columns
  • EQ, NEQ (exact timestamp)
  • GT (after), GTE (on or after), LT (before), LTE (on or before)
  • IS_SAME_DAY, IS_DIFFERENT_DAY
  • IN, NOT_IN
  • IS_TODAY, IS_YESTERDAY, IS_TOMORROW
  • IS_THIS_WEEK, IS_THIS_MONTH, IS_THIS_QUARTER, IS_THIS_YEAR
  • IS_PAST, IS_FUTURE, IS_BEFORE_TODAY, IS_AFTER_TODAY
  • IS_WORKDAY, IS_NEXT_WORKDAY, IS_PREV_WORKDAY, IS_HOLIDAY
  • IS_BLANK, IS_NOT_BLANK
Boolean Columns
  • EQ (with a checkbox editor), NEQ
  • IS_BLANK, IS_NOT_BLANK
Array Columns
  • IN, NOT_IN
  • IS_BLANK, IS_NOT_BLANK

Note

Array Columns are AG Grid array types (textArray / numberArray). IN / NOT_IN match when any element of the cell array is in the selection.