diff --git a/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml b/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml index e1407fac8f..d328bc2743 100644 --- a/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml +++ b/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml @@ -2028,6 +2028,7 @@ Gets or sets a value indicating whether the grid should save its paging state in the URL. + This is an **experimental** feature, which might cause unwanted jumping in the page when you change something in the grid. diff --git a/examples/Demo/Shared/Pages/DataGrid/Examples/DataGridTypical.razor b/examples/Demo/Shared/Pages/DataGrid/Examples/DataGridTypical.razor index 41394e2099..29f24153a3 100644 --- a/examples/Demo/Shared/Pages/DataGrid/Examples/DataGridTypical.razor +++ b/examples/Demo/Shared/Pages/DataGrid/Examples/DataGridTypical.razor @@ -12,9 +12,7 @@ RowClass="@rowClass" RowStyle="@rowStyle" HeaderCellAsButtonWithMenu="true" - ColumnResizeLabels="@customLabels" - SaveStateInUrl="true" - SaveStatePrefix="g1"> + ColumnResizeLabels="@customLabels"> Flag of @(context.Code) diff --git a/src/Core/Components/DataGrid/FluentDataGrid.razor.cs b/src/Core/Components/DataGrid/FluentDataGrid.razor.cs index 8d6942183b..f6d34a9443 100644 --- a/src/Core/Components/DataGrid/FluentDataGrid.razor.cs +++ b/src/Core/Components/DataGrid/FluentDataGrid.razor.cs @@ -271,6 +271,7 @@ public partial class FluentDataGrid : FluentComponentBase, IHandleEve /// /// Gets or sets a value indicating whether the grid should save its paging state in the URL. + /// This is an experimental feature, which might cause unwanted jumping in the page when you change something in the grid. /// [Parameter] public bool SaveStateInUrl { get; set; } @@ -425,6 +426,8 @@ protected override async Task OnAfterRenderAsync(bool firstRender) } } + SaveStateToQueryString(); + if (_checkColumnOptionsPosition && _displayOptionsForColumn is not null) { _checkColumnOptionsPosition = false; @@ -981,10 +984,4 @@ public async Task ResetColumnWidthsAsync() await Module.InvokeVoidAsync("resetColumnWidths", _gridReference); } } - - protected override void OnAfterRender(bool firstRender) - { - base.OnAfterRender(firstRender); - SaveStateToQueryString(); - } }