Loading Animation ASP.NET MVC Grid Component

9 Sep 20221 minute to read

The grid has an option to show a loading indicator in-between the time of fetching the data and binding it to the grid during initial rendering or refreshing or after performing any grid action like sorting, filtering, grouping, and more. The grid supports two indicator types, which is achieved by setting the loadingIndicator.indicatorType property to Spinner or Shimmer. The default value of the indicator type is “Spinner.”

In the following sample, the Shimmer indicator is displayed while the grid is loading and refreshing when using the remote data.

@Html.EJS().Grid("Grid").AllowSorting(true).AllowFiltering(true).DataSource(dataManger =>
    {
        dataManger.Url("https://js.syncfusion.com/demos/ejServices/Wcf/Northwind.svc/Orders/").Adaptor("ODataAdaptor");
    }).Columns(col =>
        {
            col.Field("OrderID").HeaderText("Order ID").Width("130").Add();
            col.Field("CustomerID").HeaderText("Customer ID").Width("150").Add();
            col.Field("EmployeeID").HeaderText("Employee ID").Width("115").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
            col.Field("Freight").HeaderText("Freight").Width("150").Format("C2").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
            col.Field("ShipCountry").HeaderText("Ship Country").Width("150").Add();
        }).AllowPaging().PageSettings(page=>page.PageCount(3)).LoadingIndicator(l => { l.IndicatorType(Syncfusion.EJ2.Grids.IndicatorType.Shimmer); }).Render()
public IActionResult Index()
{
    return view(); 
}