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

html5-scheduler-dynamic-tree-node-loading.png

JavaScript

javascript-scheduler-dynamic-tree-loading.png

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: "Room A", id: "A", dynamicChildren: true } ];

// async
dp.onLoadNode = function(args) {
    args.async = true;
    
    // simulating slow server-side load
    setTimeout(function() {
        args.resource.children = [
            { name : "Room 111", id : "111"},
            { name : "Room 112", id : "112"}
        ];
        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.png

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.png