From 139867ec3205e5b1d9648f0a27f4009d6d0e9320 Mon Sep 17 00:00:00 2001 From: Sacred <Sacred> Date: Wed, 12 Mar 2025 15:36:46 +0700 Subject: [PATCH] Enhanced ReloadSettings and LoadSettingsInternal methods with additional parameters and improved documentation - Added `forceReload` parameter to `ReloadSettings` method to allow forced reloading of settings. - Added `forceUpdate` parameter to `LoadSettingsInternal` method to allow forced updates of settings. - Updated XML comments for both methods to clarify their purpose, parameters, and behavior. --- Radzen.Blazor/RadzenDataGrid.razor.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Radzen.Blazor/RadzenDataGrid.razor.cs b/Radzen.Blazor/RadzenDataGrid.razor.cs index eebdcd02e00..b1b19f23b94 100644 --- a/Radzen.Blazor/RadzenDataGrid.razor.cs +++ b/Radzen.Blazor/RadzenDataGrid.razor.cs @@ -2424,12 +2424,14 @@ internal override async Task ReloadOnFirstRender() /// <summary> /// Force load of the DataGrid Settings. + /// This method triggers a reload of the DataGrid settings, optionally forcing a reload even if the settings are already loaded. /// </summary> - public async Task ReloadSettings() + /// <param name="forceReload">If true, forces a reload of the settings regardless of their current state. Default is false.</param> + public async Task ReloadSettings(bool forceReload = false) { if (settings != null) { - await LoadSettingsInternal(settings); + await LoadSettingsInternal(settings, forceReload); } } @@ -3422,13 +3424,16 @@ public void SaveSettings() } /// <summary> - /// Load DataGrid settings saved from GetSettings() method. + /// Load DataGrid settings saved from the GetSettings() method. + /// This internal method handles the actual loading or updating of the DataGrid settings. /// </summary> - internal async Task LoadSettingsInternal(DataGridSettings settings) + /// <param name="settings">The DataGridSettings object containing the settings to be loaded.</param> + /// <param name="forceUpdate">If true, forces an update of the settings even if they haven't changed. Default is false.</param> + internal async Task LoadSettingsInternal(DataGridSettings settings, bool forceUpdate = false) { if (SettingsChanged.HasDelegate) { - var shouldUpdateState = false; + var shouldUpdateState = forceUpdate; var hasFilter = settings.Columns != null && settings.Columns.Any(c => c.FilterValue != null || c.SecondFilterValue != null || c.FilterOperator == FilterOperator.IsNull || c.FilterOperator == FilterOperator.IsNotNull ||