Search results

Virtualization in ASP.NET Core Tree Grid control

TreeGrid allows you to load large amount of data without performance degradation.

Row Virtualization

Row virtualization allows you to load and render rows only in the content viewport. It is an alternative way of paging in which the rows will be appended while scrolling vertically. To setup the row virtualization, you need to define enableVirtualization as true and content height by height property.

The number of records displayed in the TreeGrid is determined implicitly by height of the content area and a buffer records will be maintained in the TreeGrid content in addition to the original set of rows.

Expand and Collapse state of any child record will be persisted.

<ejs-treegrid id="TreeGrid" height="600" dataSource="ViewBag.datasource" enableVirtualization="true"  childMapping="Children" treeColumnIndex="1">
        <e-treegrid-column field="TaskID" headerText="Player Jersey" textAlign="Right" width="120"></e-treegrid-column>
        <e-treegrid-column field="FIELD1" headerText="Player Name" width="120"></e-treegrid-column>
        <e-treegrid-column field="FIELD2" headerText="Year" textAlign="Right" width="100"></e-treegrid-column>
        <e-treegrid-column field="FIELD3" headerText="Stint" textAlign="Right" width="120"></e-treegrid-column>
        <e-treegrid-column field="FIELD4" headerText="TMID" textAlign="Right" width="120"></e-treegrid-column>
public IActionResult VirtualScrolling()
            ViewBag.datasource = VirtualDataFormat.GetVirtualData();
            return View();

Limitations for Virtualization

  • Due to the element height limitation in browsers, the maximum number of records loaded by the treegrid is limited by the browser capability.
  • Cell selection will not be persisted in row.
  • Virtual scrolling is not compatible with detail template and row drag and drop features.
  • Row count of the page is not depend on the pageSize property of the pageSettings. Row count for the page is determined by the height given to the TreeGrid.
  • The virtual height of the treegrid content is calculated using the row height and total number of records in the data source and hence features which changes row height such as text wrapping are not supported. If you want to increase the row height to accommodate the content then you can specify the row height as below to ensure all the table rows are in same height.
  • Programmatic selection using the selectRows method is not supported in virtual scrolling.