Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2005,6 +2005,7 @@
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentDataGrid`1.SaveStateInUrl">
<summary>
Gets or sets a value indicating whether the grid should save its paging state in the URL.
<para>This is an **experimental** feature, which might cause unwanted jumping in the page when you change something in the grid.</para>
</summary>
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentDataGrid`1.SaveStatePrefix">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
RowStyle="@rowStyle"
HeaderCellAsButtonWithMenu="true"
Style="height: 405px;overflow:auto;"
ColumnResizeLabels="@customLabels"
SaveStateInUrl="true"
SaveStatePrefix="g1">
ColumnResizeLabels="@customLabels">
<TemplateColumn Tooltip="true" HeaderTooltip="Flag of each team" TooltipText="@(c => "Flag of " + c.Name)" Title="Rank" SortBy="@rankSort" Align="Align.Center" InitialSortDirection="SortDirection.Ascending" IsDefaultSortColumn=true>
<img class="flag" src="_content/FluentUI.Demo.Shared/flags/@(context.Code).svg" alt="Flag of @(context.Code)" />
</TemplateColumn>
Expand Down
9 changes: 3 additions & 6 deletions src/Core/Components/DataGrid/FluentDataGrid.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ public partial class FluentDataGrid<TGridItem> : FluentComponentBase, IHandleEve

/// <summary>
/// Gets or sets a value indicating whether the grid should save its paging state in the URL.
/// <para>This is an experimental feature, which might cause unwanted jumping in the page when you change something in the grid.</para>
/// </summary>
[Parameter]
public bool SaveStateInUrl { get; set; }
Expand Down Expand Up @@ -407,6 +408,8 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
}
}

SaveStateToQueryString();

if (_checkColumnOptionsPosition && _displayOptionsForColumn is not null)
{
_checkColumnOptionsPosition = false;
Expand Down Expand Up @@ -939,10 +942,4 @@ public async Task ResetColumnWidthsAsync()
await Module.InvokeVoidAsync("resetColumnWidths", _gridReference);
}
}

protected override void OnAfterRender(bool firstRender)
{
base.OnAfterRender(firstRender);
SaveStateToQueryString();
}
}
Loading