Error occurs when adding in treegrid
An error occurs when adding
hello.
I am working with TreeGrid.
However, when you click "Add", the following error message appears.
"blazor.server.js:1
[2024-05-23T05:21:08.100Z] Error: System.NullReferenceException: Object reference not set to an instance of an object.
at Syncfusion.Blazor.TreeGrid.Internal.Edit`1.ActionBegin(ActionEventArgs`1 args, ActionEventArgs`1 remoteArgs)
at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.PostAsync[TState](Task antecedent, Action`1 callback, TState state)"
so,
https://blazor.syncfusion.com/demos/tree-grid/inline-editing?theme=fluent
After importing the source code here and modifying the “TreeGridEditSettings” part,
"<TreeGridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="Syncfusion.Blazor.TreeGrid.EditMode.Row" NewRowPosition="RowPosition.Below"></TreeGridEditSettings>"
Even if you test it, the same error occurs when you click "Add".
I checked and found that an error occurs when I press "Add" when a row in the grid is selected, but if there is no selected row, it works normally.
It seems that there must be a selected row in order to insert the parentid into the new row to be created, but I would like to know why an error occurs.
(syncfusion ver - 24.2.3)
Hi Junghwi,
Greetings from Syncfusion.
We have prepared sample from shared demo link but we are able to replicate the problem while adding after selection. Refer to the sample attached
We need some more additional detail to find the cause of the issue. Share us the following details.
- Complete TreeGrid code(Any modifications other than this).
- Have you faced the issue on enabling specific properties(like Virtualization or any other).
- If possible replicate from above shared sample and revert us back.
Regards,
Farveen sulthana T
Attachment: BlazorApp1local_ff5f9196.zip
There are a few things I don't understand while testing the source code you sent me.
1. "this.TreeData = DateOnlyTimeOnlyData.GetWrapData().ToList();"
When running, it executes normally within "protected override void OnInitialized()", but no data is displayed in TreeGrid in "protected override async Task OnAfterRenderAsync(bool firstRender)".
2. There is a source that I am working on. There, data appears only when EnableVirtualization="true" is set in the TreeGrid property.
(Data is received remotely from DB.)
3. By any chance, should the top parent value be null?
Please reply.
Junghwi,
We need additional information to proceed further. Please share the following information to proceed further.
For Query 1 :
- Are you using both OnInitialize and OnAfterRenderAsync to define the dataSource?
- Can you define the reason for assigning dataSource in OnAfterRenderAsync?
For query 2 :
- As you mentioned, you are using remode data, how you have bound the dataSource i.e., are you binding Json data returned from the backend or you are using Datamanager?
- Adaptor that you are using in your sample.
For Query 3 :
The top parent id should always be null. Kindly share more details regarding this requirement.
Kindly share the above details to proceed further.
Regards,
Shek
- 3 Replies
- 3 Participants
-
JU junghwi
- May 23, 2024 07:15 AM UTC
- Jun 3, 2024 08:29 PM UTC