System Filters
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: undefinedfunction- This demo uses
isExpressionFunctionAvailableto limit the operators offered in each Column's Filter dropdown:- The
NameColumn offers only theCONTAINS,ENDS_WITHandREGEXoperators - All other Columns offer whichever of
CONTAINS,GT,EQ,IS_THIS_MONTHandINare relevant to that Column's Data Type
- The
- Open the various filter dropdowns and see that there is a much reduced list of operators available
- Open the
Namedropdown and see that the list provided just for that Column is shown
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 Type | Options Property | Default | Available Values |
|---|---|---|---|
| text | defaultTextColumnFilter | CONTAINS | EQ NEQ CONTAINS NOT_CONTAINS STARTS_WITH ENDS_WITH REGEX IN NOT_IN IS_BLANK IS_NOT_BLANK |
| numeric | defaultNumericColumnFilter | EQ | GT GTE LT LTE EQ NEQ IN NOT_IN IS_BLANK IS_NOT_BLANK |
| date | defaultDateColumnFilter | IS_SAME_DAY | EQ NEQ GT GTE LT LTE IS_SAME_DAY IS_DIFFERENT_DAY IN NOT_IN IS_BLANK IS_NOT_BLANK |
| array | defaultArrayColumnFilter | IN | IN 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
DefaultFilterExpressionContextobject, 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
- 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 exceptLanguagewhich is INdefaultDateColumnFilter- LT forCreatedandUpdatedcolumns, and GT for all other date columnsdefaultArrayColumnFilter- NOT_IN (provided hard-coded so is same for all array columns)
Default Text Filter
Use the defaultTextColumnFilter property to set the default filter operator for text columns.
defaultTextColumnFilter
Default: CONTAINSEQ|NEQ|CONTAINS|NOT_CONTAINS|STARTS_WITH|ENDS_WITH|IN|NOT_IN|REGEX|IS_BLANK|IS_NOT_BLANKDefault Numeric Filter
Use the defaultNumericColumnFilter property to set the default filter operator for Numeric columns.
defaultNumericColumnFilter
Default: EQGT|GTE|LT|LTE|EQ|NEQ|IN|NOT_IN|IS_BLANK|IS_NOT_BLANKDefault 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_DAYEQ|NEQ|GT|GTE|LT|LTE|IS_SAME_DAY|IS_DIFFERENT_DAY|IN|NOT_IN|IS_BLANK|IS_NOT_BLANKDefault Array Filter
Use the defaultArrayColumnFilter property to set the default filter operator for Array (text and numeric) columns.
defaultArrayColumnFilter
Default: ININ|NOT_IN|IS_BLANK|IS_NOT_BLANKAppendix: System Filter List
The boolean functions used as filter operators, by Data Type, are broadly:
Text ColumnsEQ,NEQCONTAINS,NOT_CONTAINSSTARTS_WITH,ENDS_WITHREGEXIN,NOT_INIS_BLANK,IS_NOT_BLANK
EQ,NEQGT,GTE,LT,LTEIN,NOT_INIS_POSITIVE,IS_NEGATIVEIS_BLANK,IS_NOT_BLANK
EQ,NEQ(exact timestamp)GT(after),GTE(on or after),LT(before),LTE(on or before)IS_SAME_DAY,IS_DIFFERENT_DAYIN,NOT_INIS_TODAY,IS_YESTERDAY,IS_TOMORROWIS_THIS_WEEK,IS_THIS_MONTH,IS_THIS_QUARTER,IS_THIS_YEARIS_PAST,IS_FUTURE,IS_BEFORE_TODAY,IS_AFTER_TODAYIS_WORKDAY,IS_NEXT_WORKDAY,IS_PREV_WORKDAY,IS_HOLIDAYIS_BLANK,IS_NOT_BLANK
EQ(with a checkbox editor),NEQIS_BLANK,IS_NOT_BLANK
IN,NOT_INIS_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.