BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
I am trying to use the TreeView with a custom DataAdaptor to fully customize the way the data is loaded from the server. I created a custom DataAdaptor by implementing the ReadAsync method. For the purpose of testing, I added as Task.Delay that is invoked when the root node gets expanded. However, when I expand the root node, nothing happens at all until the ReadAsync method is fully completed. Only then, the expand spinner gets shown for a brief moment. But that does not really help. The expand spinner should show before the ReadAsync method starts executing and hide after the ReadAsync method is finished.
<SfTreeView TValue="OrgUnit">
<TreeViewFieldsSettings TValue="OrgUnit" Id="Id" Text="Name" ParentID="ParentId" HasChildren="HasChildren" Expanded="Expanded">
<Syncfusion.Blazor.Data.SfDataManager AdaptorInstance="@typeof(CustomAdaptor)" Adaptor="Syncfusion.Blazor.Adaptors.CustomAdaptor" />
</TreeViewFieldsSettings>
</SfTreeView>
@code {
public class CustomAdaptor : DataAdaptor
{
public override async Task<object> ReadAsync(DataManagerRequest dataManagerRequest, string key = null)
{
int? parentId = null;
// ... (load parent id)
List<OrgUnit> OrgUnits = new List<OrgUnit>();
if(parentId == 1)
{
// Delay execution upon expanding the root node
await Task.Delay(2000);
OrgUnits.Add(new OrgUnit()
{
Id = 2, ParentId = 1, Name = "Child",
Expanded = false, HasChildren = false
});
}
else
{
OrgUnits.Add(new OrgUnit()
{
Id = 1, ParentId = null, Name = "Root",
Expanded = false, HasChildren = true
});
}
return (object)OrgUnits;
}
}
}
Hi Samuel,
Greetings from Syncfusion support.
We have validated your reported query in the Blazor TreeView component by preparing a sample. We understand that you are facing an issue where the spinner is not shown when expanding the parent node in the TreeView component's remote data sample. However, we were unable to replicate the issue with the shared code due to missing dependencies in the code.
For your reference, we have attached a sample and demo link.
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/BlazorTreeView726899226.zip
Demo: https://blazor.syncfusion.com/demos/treeview/remote-data?theme=fluent
Please check the shared details on your end and check your sample in the latest package version. If the issue still persists, please share the replicated sample (if possible) or replicate the issue in the shared sample. These details will help us validate and provide a prompt solution. Please get back to us if you need any further assistance.
Regards,
Prasanth Madhaiyan.