The TreeList component offers built-in support for filtering.
To enable filtering, set the
FilterMode property of the treelist to one of the following values:
Telerik.Blazor.TreeListFilterMode.FilterRow- a row of filter options is rendered below the column headers
Telerik.Blazor.TreeListFilterMode.FilterMenu- the column headers render a button that shows a popup with filtering options
The behavior of the filter input and the available filter operators will depend on the column data type. For example, a boolean field will only have the options "is true" and "is false" and will not have operators like "contains" or "greater than".
You can filter more than one column at a time, and all filter rules will be applied together with an
You can prevent the user from filtering a certain field by setting
Filterable="false" on its column.
Filtering keeps an item's parent(s) in the list, so you may see item that do not match the criteria. This is required so you can actually navigate to and see the items that match.
Filtering keeps the expanded/collapsed state of items. For example, if filtering leaves a child whose parent is collapsed, you will only see the collapsed parent.
In addition to the two main filtering modes, the treelist offers two more features that can enhance the user experience when looking for data:
A searchbox in the toolbar can amend the filters and let the user look up many fields at once
The filter menu can show a list of checkboxes with the distinct values from the data to make filtering resemble Excel.
You can customize the appearance and behavior of the filters through the filter templates.
- The treelist uses
Activator.CreateInstance<TItem>();to get the type of the item it is bound to in order to generate proper filters and filter operators for them. Thus, the Model should have a Parameterless constructor defined.