diff --git a/Documentation/Blazorise.Docs/Pages/Docs/Extensions/DataGrid/DataGridApi.razor b/Documentation/Blazorise.Docs/Pages/Docs/Extensions/DataGrid/DataGridApi.razor index c471a14c8b..06a6069866 100644 --- a/Documentation/Blazorise.Docs/Pages/Docs/Extensions/DataGrid/DataGridApi.razor +++ b/Documentation/Blazorise.Docs/Pages/Docs/Extensions/DataGrid/DataGridApi.razor @@ -744,4 +744,8 @@ Loads the state of the DataGrid. + + Sets the DataGrid into the loading state. + Makes sure to invoke the StateHasChanged method. + \ No newline at end of file diff --git a/Documentation/Blazorise.Docs/Pages/News/2024-07-15-release-notes-160.razor b/Documentation/Blazorise.Docs/Pages/News/2024-07-15-release-notes-160.razor index 8e6a190fd6..a30da85de3 100644 --- a/Documentation/Blazorise.Docs/Pages/News/2024-07-15-release-notes-160.razor +++ b/Documentation/Blazorise.Docs/Pages/News/2024-07-15-release-notes-160.razor @@ -87,6 +87,10 @@ + + Added a new SetLoading so you're able to control the loading state of the DataGrid. + + Wrap Up diff --git a/Source/Extensions/Blazorise.DataGrid/DataGrid.razor.cs b/Source/Extensions/Blazorise.DataGrid/DataGrid.razor.cs index 905dd2e6e1..c8289a2182 100644 --- a/Source/Extensions/Blazorise.DataGrid/DataGrid.razor.cs +++ b/Source/Extensions/Blazorise.DataGrid/DataGrid.razor.cs @@ -981,6 +981,17 @@ private async void OnPageChanged( int currentPage ) #region Commands + /// + /// Sets the DataGrid into the loading state. + /// Makes sure to invoke the StateHasChanged method. + /// + /// Whether the grid is loading or not + public void SetLoading(bool isLoading) + { + IsLoading = isLoading; + InvokeAsync(StateHasChanged); + } + /// /// Sets the DataGrid into the New state mode. /// @@ -2796,7 +2807,7 @@ internal bool IsGroupHeaderCaptionsEnabled /// /// Returns true if ReadData will be invoked. /// - protected bool IsLoading { get; set; } + public bool IsLoading { get; protected set; } /// /// Returns true if EmptyTemplate is set and Data is null or empty.