Virtual scrolling provides an alternative to paging.
While the user is scrolling the table, the TreeList renders only the rows for the current page depending on scroll position. To define the virtual scrolling functionality, set
To determine when a
pageChange event is fired so that the TreeList obtains and displays the next or the previous portion (page) of data items, the virtual scrolling functionality of the TreeList relies on calculations that are based on the fixed and equal
rowHeight of the rows, the set
pageSize of the Treelist, and the
scrollTop position of the scrollable data table container.
To configure the TreeList for virtual scrolling:
- Set its height either through its
heightinput or through the
- Set the row height.
To work properly, virtual scrolling requires you to set the following configuration options:
scrollable—Set it to
rowHeight—Has to represent the actual
heightof each TreeList row (
tr) element in the DOM. The provided
rowHeightnumber is used for internal calculations and does not set the row height of the TreeList.
pageSize—To avoid unexpected behavior during scrolling, set
pageSizeto at least three times the number of the visible TreeList elements. The number of the visible TreeList elements is determined by the
rowHeightsettings of the TreeList.
The following example demonstrates the virtualization of local data.
The following example demonstrates the virtualization of remote data.
You can use virtual scrolling in combination with aggregates by utilizing the
kendoTreeListHierarchyBinding directive. The directives support only the processing of in-memory data and you have to provide the full set of data that will be processed.
The following example demonstrates the virtualization of aggregated hierarchical data.
The virtual scrolling functionality requires that all TreeList rows have an equal, predefined height. However, you can still keep virtual scrolling and use responsive columns which have different cell templates based on the column width.
The TreeList's virtual scrolling may be affected by browser-specific limitations in terms of the maximum height of the container element. Values higher than the browser's limit cannot ensure reliable vertical scrolling and the scrollbar's thumb may seem immovable.