Available in the Full Version

Tree Grid - Load on Demand

This sample demonstrates how to use the load on demand functionality of igTreeGrid.
Show
records
IDFirst NameLast NameEmailTitleHire Date

This sample is designed for a larger screen size.

On mobile, try rotating your screen, view full size, or email to another device.

Load on demand functionality enables the tree grid to request the data for the child nodes from the server as the user interacts with the grid (expands a node). This approach significantly reduces the amount of data being transferred between the browser and the server. In order to take advantage of the remote load on demand functionality, the controller action responsible for processing the requests should be decorated with TreeGridDataSourceAction attribute. As you expand a row, the grid makes an Ajax call to the server.

Code View

Copy to Clipboard
@using Infragistics.Web.Mvc
@using IgniteUI.SamplesBrowser.Models.Northwind
@using System.Data
@model Infragistics.Web.Mvc.TreeGridModel

<!DOCTYPE html>

<html>
<head>
    <title></title>

    <!-- Ignite UI for jQuery Required Combined CSS Files -->
    <link href="http://cdn-na.infragistics.com/igniteui/2024.2/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" />
    <link href="http://cdn-na.infragistics.com/igniteui/2024.2/latest/css/structure/infragistics.css" rel="stylesheet" />

    <script src="http://ajax.aspnetcdn.com/ajax/modernizr/modernizr-2.8.3.js"></script>
    <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
    <script src="http://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script>

    <!-- Ignite UI for jQuery Required Combined JavaScript Files -->
    <script src="http://cdn-na.infragistics.com/igniteui/2024.2/latest/js/infragistics.core.js"></script>
    <script src="http://cdn-na.infragistics.com/igniteui/2024.2/latest/js/infragistics.lob.js"></script>
</head>
<body>
        @(Html.Infragistics().TreeGrid<IgniteUI.SamplesBrowser.Models.EmployeeData>()
        .DataSourceUrl(Url.Action("GetTreeData"))
        .Width("100%")
        .Height("600px")
        .ID("TreeGrid")
        .EnableRemoteLoadOnDemand(true)
        .AutoGenerateColumns(false)
        .Columns(column =>
        {
            column.For(x => x.ID).HeaderText("ID").DataType("number").Width("20%");
            column.For(x => x.FirstName).HeaderText("First Name").DataType("string").Width("10%");
            column.For(x => x.LastName).HeaderText("Last Name").DataType("string").Width("10%");
            column.For(x => x.Email).HeaderText("Email").DataType("string").Width("25%");
            column.For(x => x.Title).HeaderText("Title").DataType("string").Width("20%");
            column.For(x => x.HireDate).HeaderText("Hire Date").DataType("date").Width("15%");

        })
        .PrimaryKey("ID")
        .ChildDataKey("Employees")
        .Features(features =>
        {
            features.Paging().Type(OpType.Remote).Mode(TreeGridPagingMode.RootLevelOnly).PageSize(3);
            features.Filtering().Type(OpType.Remote).DisplayMode(TreeGridFilteringDisplayMode.ShowWithAncestors);
            features.Sorting().Type(OpType.Remote);
        })
        .DataBind()
        .Render()
    )
</body>
</html>