From 7049530c354eb658b8988664ce49c74104e78155 Mon Sep 17 00:00:00 2001 From: Stephan van Rooij <1292510+svrooij@users.noreply.github.com> Date: Fri, 29 Nov 2024 11:59:11 +0100 Subject: [PATCH 1/2] Fix datagrid page reload --- src/Core/Components/DataGrid/FluentDataGrid.razor.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Core/Components/DataGrid/FluentDataGrid.razor.cs b/src/Core/Components/DataGrid/FluentDataGrid.razor.cs index d795f73b13..75c8e4f4f5 100644 --- a/src/Core/Components/DataGrid/FluentDataGrid.razor.cs +++ b/src/Core/Components/DataGrid/FluentDataGrid.razor.cs @@ -407,6 +407,8 @@ protected override async Task OnAfterRenderAsync(bool firstRender) } } + SaveStateToQueryString(); + if (_checkColumnOptionsPosition && _displayOptionsForColumn is not null) { _checkColumnOptionsPosition = false; @@ -939,10 +941,4 @@ public async Task ResetColumnWidthsAsync() await Module.InvokeVoidAsync("resetColumnWidths", _gridReference); } } - - protected override void OnAfterRender(bool firstRender) - { - base.OnAfterRender(firstRender); - SaveStateToQueryString(); - } } From b743805840dca240870ebd316a3a00f33d792552 Mon Sep 17 00:00:00 2001 From: Stephan van Rooij <1292510+svrooij@users.noreply.github.com> Date: Fri, 29 Nov 2024 14:03:27 +0100 Subject: [PATCH 2/2] DataGrid SaveStateInUrl disabled in example site --- .../Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml | 1 + .../Demo/Shared/Pages/DataGrid/Examples/DataGridTypical.razor | 4 +--- src/Core/Components/DataGrid/FluentDataGrid.razor.cs | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml b/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml index aad50f47dc..fde155a0d5 100644 --- a/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml +++ b/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml @@ -2005,6 +2005,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 43fd95f815..84195fa744 100644 --- a/examples/Demo/Shared/Pages/DataGrid/Examples/DataGridTypical.razor +++ b/examples/Demo/Shared/Pages/DataGrid/Examples/DataGridTypical.razor @@ -13,9 +13,7 @@ RowStyle="@rowStyle" HeaderCellAsButtonWithMenu="true" Style="height: 405px;overflow:auto;" - 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 75c8e4f4f5..536864dcae 100644 --- a/src/Core/Components/DataGrid/FluentDataGrid.razor.cs +++ b/src/Core/Components/DataGrid/FluentDataGrid.razor.cs @@ -250,6 +250,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; }