I have an sfgrid control in my application.I have bind data in grid which contains 4000 records.But It take 10 to 15 seconds to load data in grid on initial load.please advise how to improve performance in grid on initial load.
Note:-
I have enabled paging and virtualization but still I am getting performance issue on initial load.
Sorry for late reply..
I have check above code,and there is no issue in local datasource but when I bind data from web api then its taken long time to load data
What is the best way to load data in grid via api??
Sorry for late reply..
I have tested the performance issue.It seems its related to blazor web assembly.
Actually when I get data from blazor client side using "GetFromJsonAsync" then it takes time to fetch data from server.where as when I test the same api in postman tool then its very fast to fetch data from server.
Please advise how to fetch data as fast in blazor web assembly .
Note:-
I am using .net 5.0 with visual studio 2019
|
@inject HttpClient Http
@if (forecasts != null) //render the Grid while the data is available
{
<SfGrid DataSource="forecasts" AllowPaging="true" @ref="dataGrid">
<GridColumns>
<GridColumn Field="@nameof(WeatherForecast.Id)" IsPrimaryKey="true"></GridColumn>
<GridColumn Field="@nameof(WeatherForecast.Date)" HeaderText="Date"></GridColumn>
<GridColumn Field="@nameof(WeatherForecast.Summary)" HeaderText="Summary"></GridColumn>
<GridColumn Field="@nameof(WeatherForecast.TemperatureF)" HeaderText="F"></GridColumn>
</GridColumns>
</SfGrid>
} else
{
<p>Loading...Fetching Data...</p>
}
@code {
SfGrid<WeatherForecast> dataGrid;
private WeatherForecast[] forecasts;
protected override async Task OnInitializedAsync()
{
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("WeatherForecast");
}
} |
Pay attention to NOT add a grid.Refresh() in your code.
I.e. I had await _grid.Refresh(); in the OnAfterRenderAsync and this takes a lot before renderi the grid.
Commenting this code the speed is really good.
Hi Nicola,
Thanks for contacting Syncfusion support.
We have checked your query and state that using Grid.Refresh() method will refresh the entire grid component. Having initial delay is a default behavior of this Grid.Refresh method. Can you explain why you want to use OnAfterRenderAsync on the refresh method? This will help us to investigate your issue further.
Please get back to us if you have any other related query
Regards,
Sarveswaran PK