The Telerik UI for Blazor TreeList component is a data container element, similar in many ways to the Grid. Unlike the Grid, it stores and displays a list of items in a hierarchy. It is designed to be used for when you want to combine the clean and accessible UI of a Grid but also add a tad of extra information – namely some relationship between the items in the list. Examples include:
Providing the data for the TreeList component can be done either by:
Data binding the entire list data makes usage trivial and allows you to focus on other more important things – like if you want your data to be loaded on demand which we also support.
Learn more about Blazor TreeList Data Binding in our documentation.
The Blazor TreeList enables users to resize columns manually by dragging between their headers. It also allows you to resize its columns programmatically. This ensures your content is displayed properly and nothing important is hidden. You can use three different methods to resize the TreeList columns:
AutoFitColumn adjusts the width of a single column
AutoFitColumns adjusts the width of multiple columns
AutoFitAllColumns adjusts the width of all columns
Making good use of this component requires it to be very flexible to be useful in all situations. For this reason, the columns of the Telerik UI for Blazor TreeList can be:
The TreeList implements dedicated CRUD events to make editing easy. Excel-like editing is also supported in which the number of keystrokes is greatly reduced – hitting Enter will store the current cell value, move on to the next cell in the column, and automatically select its content so that the next keystroke will override it. The full list of events is too large to be listed but suffice it to say we have everything covered in the docs. There are 3 distinct editing modes:
Inline editing lets the user directly modify any given entry and all ofits columns. This editing mode is a good mix between being fast to access and letting the user change everything. The mode allows editing, saving and deleting an item, in case the user clicks the delete button, a Delete Confirmation popup will be displayed which would require the user to confirm or cancel the action.
All 3 editing modes support built-in integration with Telerik UI for Blazor’s Form Validation.
Edited cells are always visible and selected so that users can always look see what they are modifying.
You can customize the built-in filtering of the Blazor TreeList using the DefaultFilterOperator and ShowFilterCellButtons parameters. They allow you to set the default filter operator and control whether the filter dropdown and clear buttons are visible.
Let your users find the data they are looking for with the TreeList Search Box. Enabling this feature adds a text box in which text can be typed and the TreeList will filter out records which do not match the text. The Search Box also features a small X button to easily clear its contents which can also be triggered programmatically.
Try out the TreeList SearchBox
The Blazor TreeList component exposes multiple settings for its popup editor in the dedicated TreeListPopupEditSettings tag. You can set the (max) width, (max) height, CSS . In addition, we provided TreeListPopupEditFormSettings tag that allows you to configure the orientation of the form (either horizontal, or vertical), the columns, and column spacing layout parameters of the form, and the horizontal alignment of the Buttons in the form through ButtonsLayout.
You can customize the filter editor rendered within the Blazor TreeList FilterRow, FilterMenu and ColumnMenu. Using the FilterEditorType parameter within the TreeListColumn tag, you can easily set it and render a DateTime picker rather than the default Date picker or use the TextArea instead of the default Textbox.
See how to change the default row filter editors in the Blazor TreeList.
See how to change the default field editors in the Blazor TreeList.
Use the TreeList column Visible property to programmatically control which Grid columns are visible. When a column needs to stay hidden at all times, you can directly set the column property Visible to false. However, you can also dynamically manage the column’s visibility in other cases when you need to provide conditional visibility (e.g. to hide currently uninteresting data).
By default, the TreeList only allows a single criteria to be used when sorting. When this option is enabled, users can choose to do better—sorting on a column and then sorting another one applies both sorting criteria to the data (in the order specified).
Check out the Blazor TreeList Sorting demo
The FilterEditorFormat parameter of the Blazor TreeList components allows control over the format of the default filter. That way you can align the formatting of values in the column display and filter editor.
The TreeList also provides a toolbar to which you can add actions not tied to a given row. There is one built-in command – Add. Custom commands can be added declaratively – you only need to specify name, an optional icon and a function to be called when the corresponding button is pressed.
The Telerik UI for Blazor TreeList control works with templates to let you override the visuals of all of its components – from the looks of cells, columns and rows, to column headers, and even specifying custom editors for edit mode or custom UI for filtering!
The Telerik UI for Blazor TreeList’s OnCellRender event is triggered whenever a TreeList columns is rendered. Called for every cell in the column, the event handler receives data about the items for which the given cell is used. This is the best place to modify the CSS class of the cell depending on some condition in the data.
Check out the demo on Blazor TreeList Formatting
The OnRowRender event is triggered when some row of the Grid is rendered. It is called once for each item in the collection. The item itself is passed to the event handler. This method is to be used to conditionally format the different rows (e.g. put a background on every row containing a certain substring in one of its columns).
By default, the data in the TreeList is not selectable but you can change it to allow either single-row or multi-row selection. Selection works as you expect it - use Ctrl or Shift to extend or reduce the selection. Selected rows are accessible programmatically through a property so that you can execute commands only on them. With multiple selection, you can also have the Treelist select children of selected rows automatically. Select rows by clicking them or add a checkbox for selection to preserve the click interaction for cell editing.
Large datasets are hard to read and understand without some structure. That’s why functionality like paging is crucial for enabling users to make sense of the patterns and underlying information the list contains.
The TreeList pager can be customized in four different ways:
The third pillar of user interactions for large amounts of data is sorting. Similarly to filtering, the UI interactions for sorting are built in the component – clicking on a column’s header will sort all entries depending on the values in it. Sorting can be optionally disabled on columns for which it doesn’t make sense.
Filtering is another key feature for users to understand the structure in the data. Filtering is supported on any column in the TreeList and comes out of the box. The component will check the type of the data in the column in order to make a decision on what type of filtering is required. For example, if the values are numbers, the filter will suggest predicates like “Is Equal To” or “Is Greater Than”.
Two modes of filtering UI are supported:
Filter row is easier and faster to use whereas Filter Menu has more powerful options. It’s up to you to decide which one should the user be presented with.
Check out the Telerik UI for Blazor TreeList Filter Menu
The TreeList presents end-users with many configurable elements – e.g. the currently applied filtering and sorting rules. The set of configurable elements is the TreeList’s state. The component allows developers to programmatically save, load and change the current state. This means you can make sure the end-user always starts from the same place they were at the last time they used your application.
Learn more about the TreeList Persist State
The Blazor TreeList component exposes multiple events that let you handle programmatic logic. These include data management events like OnCreate, OnUpdate and OnDelete, visibility events like OnExpand and OnCollapse, action events like OnRowClick, OnRowDoubleClick, OnRowContextMenu
, and more.
The full list of events and details about the condition under which they are triggered is available in the Blazor TreeList documentation.
The TreeList columns provide a way to specify horizontal alignment for the content through the TextAlign parameter. You can easily align numbers to the right and text to the left to implement the classic alignment standards within your project. Or if you prefer you can center the text within the cells.
Explore the Different Formatting Options
he Telerik Blazor TreeList component has several built-in themes such as Default (our own styling), Material (based on the Material Design guidelines), Bootstrap (which looks like the Bootstrap styling to integrate better) and Fluent (based on Microsoft Fluent UI). You can easily customize any of out-of-the-box themes, style a specific component instance or create new theme to match your colors and branding by using the Telerik SASS ThemeBuilder application.
The TreeList component supports a ton of keyboard shortcuts, allowing users to do everything they would normally do using a mouse, including navigating the items of the TreeList, selecting and editing them.
See Telerik UI for Blazor in action and check out how much it can do out-of-the-box.
Try Telerik UI for Blazor with dedicated technical support.