Skip to content

Commit

Permalink
DataGrid: add SetLoading API (Megabit#5549)
Browse files Browse the repository at this point in the history
* DataGrid | SetLoading

* Release notes

* Docs DataGridApi add SetLoading

* Public IsLoading

* fix paragraph
  • Loading branch information
David-Moreira authored Jun 3, 2024
1 parent 77f6157 commit 95d0ecd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -744,4 +744,8 @@
<DocsMethodsItem Name="LoadState" ReturnType="Task" Parameters="DataGridState<TItem> dataGridState">
Loads the state of the DataGrid.
</DocsMethodsItem>
<DocsMethodsItem Name="SetLoading" ReturnType="void" Parameters="bool isLoading">
Sets the DataGrid into the loading state.
Makes sure to invoke the StateHasChanged method.
</DocsMethodsItem>
</DocsMethods>
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@
</UnorderedListItem>
</UnorderedList>

<Paragraph>
Added a new <Code>SetLoading</Code> so you're able to control the loading state of the DataGrid.
</Paragraph>

<Heading>
Wrap Up
</Heading>
Expand Down
13 changes: 12 additions & 1 deletion Source/Extensions/Blazorise.DataGrid/DataGrid.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,17 @@ private async void OnPageChanged( int currentPage )

#region Commands

/// <summary>
/// Sets the DataGrid into the loading state.
/// <para>Makes sure to invoke the StateHasChanged method.</para>
/// </summary>
/// <param name="isLoading">Whether the grid is loading or not</param>
public void SetLoading(bool isLoading)
{
IsLoading = isLoading;
InvokeAsync(StateHasChanged);
}

/// <summary>
/// Sets the DataGrid into the New state mode.
/// </summary>
Expand Down Expand Up @@ -2796,7 +2807,7 @@ internal bool IsGroupHeaderCaptionsEnabled
/// <summary>
/// Returns true if ReadData will be invoked.
/// </summary>
protected bool IsLoading { get; set; }
public bool IsLoading { get; protected set; }

/// <summary>
/// Returns true if EmptyTemplate is set and Data is null or empty.
Expand Down

0 comments on commit 95d0ecd

Please sign in to comment.