New to KendoReactStart a free 30-day trial

Virtual Scrolling

Virtual scrolling provides an alternative to paging.

While the user is scrolling the table, the Grid requests and displays only the visible pages.

Getting Started

To set up the Grid for virtual scrolling:

  1. Set its height either through its style property.
  2. Set the regular or detail row height and the number of records.
  3. Provide the data for each page through the onPageChange event handler. You can also pass all the data.

To work properly, the virtualization requires you to set the following configuration options:

  • (Required) scrollable—Set it to virtual.
  • (Required) height through style
  • (Required) skip
  • (Required) total
  • (Required) pageSize—To avoid unexpected behavior during scrolling, set pageSize to at least twice the number of the visible Grid elements. The number of the visible Grid elements is determined by the height and rowHeight settings of the Grid.
  • (Required) data
  • (Required) rowHeight
Change Theme
Theme
Loading ...

Using Virtualization with Grouping

You can use virtual scrolling in combination with grouped data.

  1. Set the groupable and group options of the Grid.
  2. Set the scrollable option to virtual.
  3. Handle the emitted onDataStateChange event. The onDataStateChange event fires upon user interaction with the scrolling or changing the groups, and then processes the data and returns the data to the Grid.

To programmatically implement the processing of the data, either:

  • Send a request to the server to execute the grouping on the server side, or
  • Use the process method of the DataQuery library which automatically processes the data.

The Grid expects the grouped data to be a collection of GroupResults.

Change Theme
Theme
Loading ...

Using Virtualization with Detail Rows

You can also use DOM virtualization in combination with detail rows.

  1. Set the detail to the detail component.
  2. Set the detailRowHeight to the detail component height.
  3. Set the detailExpand prop to handle the expand state of the Grid internally.
  4. Set the onExpandChange
Change Theme
Theme
Loading ...

Using Virtualization with Responsive Columns

The virtual scrolling functionality requires that all Grid 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.

Change Theme
Theme
Loading ...

Debouncing pageChange Events

When configured for virtualization, the Grid fires the onPageChange event as often as possible. This behavior allows for a smoother scrolling experience when the data is available in memory.

If the data is requested from a remote service, it is advisable to debounce or otherwise limit the page changes.

Change Theme
Theme
Loading ...