From 95d0ecda056b515dffc8ebbed07e99ffe17f83a2 Mon Sep 17 00:00:00 2001 From: David Moreira Date: Mon, 3 Jun 2024 11:28:23 +0100 Subject: [PATCH] DataGrid: add SetLoading API (#5549) * DataGrid | SetLoading * Release notes * Docs DataGridApi add SetLoading * Public IsLoading * fix paragraph --- .../Docs/Extensions/DataGrid/DataGridApi.razor | 4 ++++ .../Pages/News/2024-07-15-release-notes-160.razor | 4 ++++ .../Extensions/Blazorise.DataGrid/DataGrid.razor.cs | 13 ++++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) 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.