Welcome to the Blazor feedback portal. We’re happy you’re here! If you have feedback on how to improve the Blazor, we’d love to hear it!>
Thanks for joining our community and helping improve Syncfusion products!
I tried to follow your example in
https://blazor.syncfusion.com/documentation/datagrid/custom-binding/#custom-adaptor-as-component
to create my own version of (remote) data provider.
So, following the example, I created a grid configured like:
<SfGrid @ref="Grid" ID="Grid" TValue="Friend" AllowSorting="true" AllowPaging="true" AllowFiltering="true">
<SfDataManager Adaptor="Adaptors.CustomAdaptor">
<CustomGridAdaptorComponent></CustomGridAdaptorComponent>
</SfDataManager>
And created the [customGridAdaptorComponent.razor] implementation. Since it never worked for me, I removed excess code to remain with this last simple example, that still doesn't work:
@inherits DataAdaptor<Friend>
<CascadingValue Value="@this">
@ChildContent
</CascadingValue>
@code {
[Parameter]
[JsonIgnore]
public RenderFragment ChildContent { get; set; }
public override object Read(DataManagerRequest dm, string key = null)
{
Friend[] friends = new Friend[]
{
new Friend{Id = Guid.NewGuid(), Name = "aaa", City = "bbb", Kind = Friend.RelationshipKind.Best },
new Friend{Id = Guid.NewGuid(), Name = "ccc", City = "ddd", Kind = Friend.RelationshipKind.Best }
};
return new DataResult
}
}
I tried to change the return value to:
- return new DataResult
- return new object{ Result = friends, Count = 2 }
- return new object{ result = friends, count = 2 }
But with no difference.
Registering an OnActionFailure event, the error I always get back is (stack trace from Syncfusion.Blazor.Grids.FailureEventArgs args:
' at Syncfusion.Blazor.Grids.SfGrid`1.
at Syncfusion.Blazor.Grids.SfGrid`1.
I'm probably missing something stupid, but i don't think to read anything more than this, in the example.