Skip to content

Commit

Permalink
DataGrid CheckBoxList filter values collection will respect filters a…
Browse files Browse the repository at this point in the history
…pplied to other columns
  • Loading branch information
enchev committed Jun 28, 2024
1 parent 340483b commit c08a598
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 8 additions & 0 deletions Radzen.Blazor/RadzenDataGrid.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,14 @@ await Filter.InvokeAsync(new DataGridColumnFilterEventArgs<TItem>()
LogicalFilterOperator = column.GetLogicalFilterOperator()
});

if (FilterMode == FilterMode.CheckBoxList)
{
allColumns.ToList().ForEach(c =>
{
c.ClearFilterValues();
});
}

SaveSettings();

if (LoadData.HasDelegate && IsVirtualizationAllowed())
Expand Down
8 changes: 6 additions & 2 deletions Radzen.Blazor/RadzenDataGridColumn.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -992,11 +992,15 @@ internal IEnumerable GetFilterValues()
property = $@"({property} == null ? """" : {property})";
}

filterValues = Grid.Data.AsQueryable().Select(DynamicLinqCustomTypeProvider.ParsingConfig, property).Distinct().Cast(propertyType ?? typeof(object));
filterValues = Grid.Data.AsQueryable().Where<TItem>(Grid.allColumns.Where(c => c != this)).Select(DynamicLinqCustomTypeProvider.ParsingConfig, property).Distinct().Cast(propertyType ?? typeof(object));
}

return filterValues;
}
internal void ClearFilterValues()
{
filterValues = null;
}

/// <summary>
/// Get column filter operator.
Expand Down Expand Up @@ -1129,7 +1133,7 @@ public async Task SetCustomFilterExpressionAsync(string value)
/// </summary>
public void ClearFilters()
{
filterValues = null;
ClearFilterValues();
SetFilterValue(null);
SetFilterValue(null, false);
SetFilterOperator(null);
Expand Down

0 comments on commit c08a598

Please sign in to comment.