I am trying to implement saving and loading filter settings for DataFilter by reading, saving, then setting again the Filters property. Filter settings are saved and restored well, but not the FilterOperator. Code to reproduce (works also in your demo)
@using RadzenBlazorDemos.Data
@using RadzenBlazorDemos.Models.Northwind
@using Microsoft.EntityFrameworkCore
@using System.Linq.Dynamic.Core
@inherits DbContextPage
<RadzenButton Text="Save Filter" Click="@SaveFilter" />
<RadzenButton Text="Load Filter" Click="@LoadFilter" />
<RadzenDataFilter @ref="dataFilter" TItem="Order">
<Properties>
<RadzenDataFilterProperty TItem="Order" Property="OrderID" Title="Order ID" />
</Properties>
</RadzenDataFilter>
@code {
RadzenDataFilter<Order> dataFilter;
IEnumerable<CompositeFilterDescriptor> filters;
void SaveFilter() => filters = dataFilter.Filters;
void LoadFilter()
{
dataFilter.Filters = filters;
StateHasChanged();
}
}
Just add a pair of filters (they are added with default filter operator, according to filter value type, as far as I understood):
Make some settings, so filters are no more default. Press "Save Filter".
Remove filters by clicking on the cross sign right to the "Add/Or" buttons of the filter. Then press "Load Filter" - filter values are restored, but not filter operators (they get their default values):
Checked only for FilterOperator and FilterValue properties. Maybe other props are also reset to their defaults.