AdapTable ships with a number of powerful System Filters which in most cases are sufficient for all needs.
But occasionally you might want to filter a column based on other data in the row or using internal logic not available to the Grid or even using an external lookup.
This is the role of Custom Predicates. You create them at at design time and provide 3 imporant pieces of information:
- Column Scope: Which Columns or DataTypes will the Predicate be relevant
- Function Scope: In which Adaptable Functions can the Predicate be called (e.g. Conditional Style, Alerts, Filters etc.)
- Handler: The actual function that will be evaluated each time the predicate is called - it receives node, column and cell details and returns a Boolean
In this example we created 4 Custom Predicates:
- High with Scope of OrderId Column that evaluates based on the data in the Invoiced and ItemCount columns
- New Starter which has Scope of Employee column, and mimics a lookup to an internal CRM system - (this is also set in Config as a column filter)
- Post Takeover which has a Scope of Date columns and evaluates true if date in cell was after a putative takeover date.
- After Work which has Scope of LastUpdatedTime Column and returns any time after 5pm - (this is also set in Config as a column filter )