Virtualized Columns
The Telerik Blazor TreeList provides Virtual Scrolling for its Columns. This means that columns and the corresponding data will be rendered only for the currently visible viewport. When changing the Page, filtering or Sorting the treelist, fewer elements are rendered which improves the responsiveness and the overall user experience.
This article provides the following sections:
Basics
The targeted scenario is for a treelist with big number of columns, since the performance improvement will be most significant there.
To enable Virtualized Columns:
-
Set the
ColumnVirtualizationparameter of the treelist totrue. -
Set the
Widthparameter of all columns inpxso that the total sum is greater than theWidthof the treelist.- This will enable horizontal scrollbar which is required. You can read more about the scrolling behavior of the treelist in the TreeList Column Width Behavior article.
-
Set the
Heightof the treelist inpx. For more information see the Notes section. -
Set the
Widthparameter of the treelist inpx.
Basic setup of the Virtualized Columns
- scrolling through the treelist is the same as without virtual scrolling, but the rendering performance and responsiveness of all other actions will be improved.
Notes
-
The row must accommodate the height of all the possible cells and their content in order to ensure good appearance. If certain cells that are not rendered have content that is taller than the rendered ones, you may experience glitches and unstable scrolling.
- The actual cell height can depend on the chosen Theme or other CSS rules, or on cell data that falls on more than one line. Inspect the rendered HTML to make sure you have CSS setting for the rows that matches the rendering, if necessary.
-
The
Heightof the treelist must be explicitly set inpx. By default the Height is set by the browser depending on the contents. When a new column is rendered during horizontal scrolling, it might increase or decrease the vertical size of the row and cause issues with the rendering and abnormal visual behavior for the users. -
Rendering the Virtual Columns in Client-side Blazor Applications is slower due to the Framework rendering limitations. In the Server-side Applications this issue is not present.
Limitations
The Virtualized Columns are a feature for improving the responsiveness and performance of the treelist in cases when the data model has a lot of properties and the volume of columns is large.
List of known limitations of the Virtualized columns:
- Frozen columns are not supported.
More Examples
Virtualized Autogenerated Columns
Column virtualization is commonly used when you have many columns. You may not have to declare them yourself, the treelist can do this for you through its Automatically Generated Columns feature.
In order to add Virtualized Autogenerated Columns, the
ColumnWidthparameter must be set in pixels.