Good evening -
Working through a fully custom grid design for reusability and everything is working, except the Grid.Refresh() call. SfDataManager using ODataV4 Adapter. On a normal SfGrid you can see the GET requests go through in the browser console/network debugger, but nothing is called when switching to the Custom Grid component and invoking Grid.Refresh(), either via manual button or via other interactions programmatically - have tried both within the custom component and outside of it. Custom component created following the example laid out here: Create custom Grid component in Blazor DataGrid Component | Syncfusion
Came up with a quick sample I've attached - Simply change the Grid Type on the Home page to see the difference when attempting to hit refresh button - CustomGrid does not make the API Call, while SfGrid does.
Hi Leviatekllc,
Greetings from Syncfusion.
We would like to inform you that instead of calling Refresh method from index.razor page we suggest you to call the refresh method from the custom grid component. We have modified and attached the shared sample. Kindly check the below attached sample and code snippet for your reference.
Here we have make a call from index page to custom grid to refresh the Grid.
|
<PageTitle>Index</PageTitle> <SfButton OnClick="RefreshCustom" Content="Refresh"></SfButton> <CustomGrid TValue="Order" @ref="CustomOrderGrid" > <SfDataManager Url="odata/Orders" Adaptor="Adaptors.ODataV4Adaptor"></SfDataManager> ... </CustomGrid>
@code { public async Task RefreshCustom() { await CustomOrderGrid.RefreshGrid(); }
}
|
|
@using Syncfusion.Blazor.Grids @typeparam TValue @inherits SfGrid<TValue>
<SfGrid @ref="CustomDataGrid" TValue = "TValue" Toolbar="@(new List<string>() {"Add", "Edit", "Delete", "Update", "Cancel", "ColumnChooser"})" @attributes=props AllowSorting="AllowSorting" AllowPaging="AllowPaging" AllowGrouping="AllowGrouping" ShowColumnChooser="ShowColumnChooser" AllowResizing="AllowResizing" AllowSelection="true"> <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true"></GridEditSettings> @ChildContent <GridPageSettings PageSize="DEFAULT_PAGE_SIZE" PageSizes="PageSizes"></GridPageSettings> </SfGrid>
@code { public SfGrid<TValue> CustomDataGrid { get; set; }
public async Task RefreshGrid() { await CustomDataGrid.Refresh(); }
}
|
Please let us know if you have any concerns.
Regards,
Monisha
Hi Monisha -
Thank you so much - I was missing the @ref in the custom component and now it works - similar logic used for the OpenColumnChooser action as well.
Cheers,
leviatekll
Hi Leviatekllc,
We are glad to here that the reported issue has been resolved at your end. Kindly get back to us if you have further queries. As always we will be happy to assist you.
Regards,
Monisha