Filtering in Code
- 2 minutes to read
To filter Tree List nodes in code, utilize the following API:
TreeList.ActiveFilterString and TreeList.ActiveFilterCriteria properties.
Allow you to specify a string filtering expression or a CriteriaOperator object.
Run demo: Filter data
TreeList.CustomRowFilter event.
Disable the Visible property in event arguments to hide a node that does not match your custom filter criteria.
Run demo: Filter nodes dynamicatlly
the Add method of the TreeList.ActiveFilter property.
Add a new filter criteria that applies filtering by a specific Tree List column.
Run demo: Filter by the specific column
the TreeList.SetAutoFilterValue method.
Enters a predefined automatic filtering row condition.
Run demo: Filter using AutoFilterRow
Note that disabling the TreeListOptionsCustomization.AllowFilter property prevents only your end-users from applying and changing Tree List filters at runtime. The filtering itself remains functional and you can still utilize all the mentioned APIs. Disable the TreeList.ActiveFilterEnabled setting to temporarily deactivate applied filters.
Example
The example below ensures that Tree List records with the 15% discount are always visible, regardless of the currently applied filtering condition.