I created a WebAsm Blazor test project, using the standard Visual Studio template.
I copied code from the Syncfusion online
DEMO, and added it to my project.
I added the Syncfusion.Blazor and Syncfusion.Blazor.Templates nuget packages.
I added startup code, as needed, to get Syncfusion.Blazor to work with my project (as outlined
HERE, in the Syncfusion getting started page)
The project I'm trying to use the TreeGrid control with, uses REST controllers on the back end, with a custom data adapter tying the data and grid together. I modified the test project to reflect that usage. That means I made the following changes:
- I added the SelfReferenceData type to my shared assembly.
- I added a GridDataController, to my server, that calls the SelfReferenceData and serves it up on a GET request.
- I added a custom data adapter to my client, that calls my REST controller for the grid data.
- I added a SfDataManager to my TreeGrid, so that it would pull data using my custom data adapter.
When I run the application it seems to load the grid just fine, but, as soon as I attempt to expand any of the child nodes, it throws this exception:
Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: The specified key '' does not exist in the ExpandoObject.
System.Collections.Generic.KeyNotFoundException: The specified key '' does not exist in the ExpandoObject.
at System.Dynamic.ExpandoObject.System.Collections.Generic.IDictionary<System.String,System.Object>.get_Item(String key)
at Syncfusion.Blazor.TreeGrid.Internal.ExpandCollapse`1.<ExpandRemoteChild>d__28[[SFTreeGrid_Test.Shared.SelfReferenceData, SFTreeGrid_Test.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at Syncfusion.Blazor.TreeGrid.Internal.ExpandCollapse`1.<RemoteExpandCollapse>d__27[[SFTreeGrid_Test.Shared.SelfReferenceData, SFTreeGrid_Test.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at Syncfusion.Blazor.TreeGrid.Internal.TreeCell`2.<ExpandCollapseClick>d__49[[System.Dynamic.ExpandoObject, System.Linq.Expressions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a],[SFTreeGrid_Test.Shared.SelfReferenceData, SFTreeGrid_Test.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)
I'm trying to understand what this problem is. Is something missing from my code? Is this a limitation of the grid control, that it can't use a custom data adapter?
Please help.
Attachment:
SFTreeGrid_Test_fc17759f.zip