Hi,I have to load data asynchronously from the web and want to display it in a SfTreeGrid using 'On Demand Loading'. However I couldn't figure out a way to populate the tree on demand when I'm calling and awaiting async functions to load the data.
As an example, if modify your OnDemandLoading Example and add a await Task.Delay(1) call to the code, it won't populate the tree with tree nodes anymore.
/// <summary>
/// Gets the reportees.
/// </summary>
/// <param name="bossID">The boss ID.</param>
/// <returns></returns>
public async Task<IEnumerable<EmployeeInfo>> GetReportees(int bossID)
{
List<EmployeeInfo> list = new List<EmployeeInfo>();
int loc = FindID(bossID);
if (loc > -1)
{
await Task.Delay(1);
while (loc < this.EmployeeDetails.Count && this.EmployeeDetails[loc].ReportsTo == bossID)
list.Add(this.EmployeeDetails[loc++]);
}
return list;
}
I then await this function in:
async void AssociatedObject_RequestTreeItems(object sender, TreeGridRequestTreeItemsEventArgs args)
How can I populate the SfTreeGrid on demand with data that is loaded asynchronously?
Regards and Thanks,
Frido