Dynamic Resource Tree Loading

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

Loading the children upon clicking the [+] expand icon.

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 ful 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);
}

See also

Demo

DayPilot for ASP.NET WebForms, DayPilot for ASP.NET MVC, DayPilot for Java