Your search did not match any results.

Tree View - Virtual Mode

In virtual mode, the TreeView loads a node's children when the node is expanded for the first time. This enhances performance on large datasets.

To enable this feature, set the virtualModeEnabled property to true. Note that this mode is only available when the TreeView's dataStructure is plain.

Backend API
@(Html.DevExtreme().TreeView() .DataSource(d => d.OData() .Version(2) .Url("https://js.devexpress.com/Demos/WidgetsGallery/odata/HierarchicalItems") ) .DataStructure(TreeViewDataStructure.Plain) .KeyExpr("Id") .DisplayExpr("Name") .ParentIdExpr("CategoryId") .HasItemsExpr("IsGroup") .VirtualModeEnabled(true) )
using DevExtreme.AspNet.Data; using DevExtreme.AspNet.Mvc; using DevExtreme.NETCore.Demos.Models; using DevExtreme.NETCore.Demos.Models.SampleData; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using System.Collections.Generic; using System.Linq; namespace DevExtreme.NETCore.Demos.Controllers { public class TreeViewController : Controller { public ActionResult VirtualMode() { return View(); } } }

When the data source is remote, the TreeView requests data for each expanded node. To prevent this for nodes that do not nest others, set the hasItems field to false for the corresponding data objects.

This demo enables virtual mode with a remote data source and uses the hasItemsExpr property to specify a custom name for the hasItems field.

As an alternative to virtual mode, you can use a custom logic to process requested data. To do this, specify the createChildren function as shown in the Load Data on Demand demo.