Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced ReloadSettings and LoadSettingsInternal methods with forceReload parameters #2027

Merged
Merged
Changes from all 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
15 changes: 10 additions & 5 deletions Radzen.Blazor/RadzenDataGrid.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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 ||
Expand Down