exception when expanding children.

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

1 Reply 1 reply marked as answer

FS Farveen Sulthana Thameeztheen Basha Syncfusion Team March 1, 2021 05:38 PM UTC

Hi Martin, 

Thanks for contacting Syncfusion Support. 

Query#:- 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: 
 
We have checked your reported problem from your attached sample, but the data has not been displayed for the Grid from your provided URL. We have modified the sample by using Custom Adaptor it works fine and doesn’t throws Exception on expanding the child nodes. 


 
Can you please reattach the runnable sample from your end or replicate the issue in the above attached sample which could be helpful for us to provide you solution as early as possible. 

Regards, 
Farveen sulthana T 



Marked as answer
Loader.
Up arrow icon