DayPilot Scheduler can load the resource tree children dynamically (upon clicking the expand [+] icon).

html5 javascript scheduler dynamic tree node loading

JavaScript

Set dynamicChildren property of a resource to true for every resource that you want to load dynamically.

See also DayPilot.Scheduler.onLoadNode.

dp.treeEnabled = true;

dp.resources = [
    {name: "Building A", id: "A", dynamicChildren: true},
    {name: "Building B", id: "B", dynamicChildren: true},
    {name: "Building C", id: "C", dynamicChildren: true}
];

// async
dp.onLoadNode = function (args) {
    args.async = true;

    // simulating slow server-side load
    setTimeout(function () {
        args.resource.children = [
            {name: "Room 111", id: args.resource.id + "111"},
            {name: "Room 112", id: args.resource.id + "112", expanded: true, children: [
                    {name: "Room 112.a", id: args.resource.id + "112a"},
                    {name: "Room 112.b", id: args.resource.id + "112b"},
                ]
            },
            {name: "Room 113", id: args.resource.id + "113"},
        ];
        args.loaded();
    }, 100);
};

Demo

ASP.NET WebForms

API

1. Specify Resource.ChildrenLoaded = false; for each tree node for which you would like to load the children on-demand. 

private void preloadTree()
{
    if (DayPilotScheduler1.Resources.Count == 0)
    {
        for(int i = 0; i < 5; i++)
        {
            Resource r = new Resource("A" + i, "A" + i);
            r.ChildrenLoaded = false;
            DayPilotScheduler1.Resources.Add(r);
        }
    }
}

2. Each such node will have the [+] expand icon (TreeImageExpand property).

3. Clicking on this node icon will fire LoadNode event:

OnLoadNode="DayPilotScheduler1_LoadNode"

4. In the event handler, add children to the selected resource (e.Resource). Remember to call full Update().

protected void DayPilotScheduler1_LoadNode(object sender, DayPilot.Web.Ui.Events.LoadNodeEventArgs e)
{
    Resource r = e.Resource;
    Resource child = new Resource("Test", Guid.NewGuid().ToString(), false);
        
    r.Children.Add(child);
    r.Expanded = true;
    r.ChildrenLoaded = true;

    DayPilotScheduler1.Update(CallBackUpdateType.Full);
}

Demo

ASP.NET MVC

When displaying a resource tree, the resource children can be loaded on demand.

You have to mark the nodes with dynamic children using DynamicChildren property in OnBeforeResHeaderRender method:

@Html.DayPilotScheduler("dps_dynamictreeloading", new DayPilotSchedulerConfig {
  BackendUrl = ResolveUrl("~/Scheduler/Backend"),
  TreeEnabled = true,
  Resources = new ResourceCollection {
      new Resource{Name = "Room A", Id = "A", DynamicChildren = true},
      new Resource{Name = "Room B", Id = "B", DynamicChildren = true},
      new Resource{Name = "Room C", Id = "C", DynamicChildren = true},
      new Resource{Name = "Room D", Id = "D", DynamicChildren = true},
      new Resource{Name = "Room E", Id = "E", DynamicChildren = true},
  }
})

These nodes will be displayed with an expand [+] icon.

scheduler asp.net mvc dynamic tree loading

After clicking the expand icon, the server-side OnLoadNode method will be called:

protected override void OnLoadNode(LoadNodeArgs e)
{
  Resource child = new Resource("Test", Guid.NewGuid().ToString());
  child.DynamicChildren = true;

  e.Resource.Children.Add(child);
  e.Resource.Expanded = true;

  Update(CallBackUpdateType.Full);
}

The node is then updated with the new icon and the DynamicChildren property is set to false.

scheduler asp.net mvc dynamic tree loading expanded