System Filter Predicates
Summary
- AdapTable provides multiple System Predicates available for use in Column Filters
- Developers are able to choose on a per-column basis which of these Predicates are available to their users
- They can also select the default Predicate (for each Column or DataType)
Available System Filters
This is the full list of System Predicates shipped by AdapTable which are available for Column Filters:
Note
All includes array types as well number, text, date and boolean
| Predicate | Column Data Type | No.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 |
Between | number | 2 |
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 |
Limiting System Filters
By default all Predicates shipped by AdapTable are fully available in the Module to which they are entitled.
This means that all the Predicates listed above which can be used in Filtering will be available to users.
AdapTable provides the systemFilterPredicates property in Predicate Options to override this if required.
systemFilterPredicates
Default: [all]string[] or function- This demo shows how to limit which System Filter Predicates are available in AdapTable by using the
systemFilterPredicatesproperty in Predicate Options - It provides a function which contains this logic:
- The Name Column will only display the
Contains,EndsWithandRegexSystem Predicates - All other Columns will show whichever of the
GreaterThan,LessThan,ThisMonth,ThisQuarterandInSystem Predicates are relevant to that Column
- The Name Column will only display the
Expand to see how System Filters are limited
- Open the various filter dropdowns and see that there is a much reduced list of Filters available
- Open the
Namedropdown and see that the list provided in the function just for that column is shown
Default Filter Predicates
AdapTable sets a default Filter Predicate 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 | Is IsNot Contains NotContains In StartsWith EndsWith Regex |
| numeric | defaultNumericColumnFilter | Equals | GreaterThan LessThan Equals NotEquals In |
| date | defaultDateColumnFilter | On | After Before On NotOn In |
| array | defaultArrayColumnFilter | In | In NotIn Blanks NonBlanks |
Hint
It is also possible to set a different default Predicate for the Filter Bar and the Filter Form
Each property offers two types of return value:
- a Predicate (relevant to the data type) directly
- a function which receives an
DefaultPredicateFilterContextobject, and returns the Predicate
Note
This is particularly useful in the Filter Bar as it sets the Predicate that is displayed by default for the Column
- This example sets the 4 different data-type related Default Predicate properties:
defaultNumericColumnFilter- GreaterThan for Filter Bar and LessThan for Filter Form (provided hard-coded for both, so is same for all numeric columns)defaultTextColumnFilter- StartsWith for all string columns exceptLanguagewhich is IndefaultDateColumnFilter- Before forCreatedandUpdatedcolumns, and After for all other date columnsdefaultArrayColumnFilter- NotIn (provided hard-coded so is same for all array columns)
Default Text Predicate
Use the defaultTextColumnFilter property to set the default Predicate for text columns.
defaultTextColumnFilter
Default: ContainsIs|IsNot|Contains|NotContains|StartsWith|EndsWith|In|RegexDefault Numeric Predicate
Use the defaultNumericColumnFilter property to set the default Predicate for Numeric columns.
defaultNumericColumnFilter
Default: EqualsGreaterThan|LessThan|Equals|NotEquals|InDefault Date Predicate
Use the defaultDateColumnFilter property to set the default Predicate for Date columns.
defaultDateColumnFilter
Default: OnAfter|Before|On|NotOn|InDefault Array Predicate
Use the defaultArrayColumnFilter property to set the default Predicate for Array (text and numeric) columns.
defaultArrayColumnFilter
Default: InIn|NotIn|Blanks|NonBlanks