I am following your demo for filter template, and my filter is multivalued - List - and my property is also a list. From reading the forum I found that it comes down to QueryableExtension::ToFilterString (radzen-blazor/QueryableExtension.cs at 1b66d6fe4df3355642d7630b5e43311d7c7a9664 · radzenhq/radzen-blazor · GitHub - am i right?) where basically takes my multivalued filter as a string and does Contains(property) on it.. So given that my property is a list I get the following error "No generic method 'Contains' on type 'System.Linq.Enumerable' is compatible with the supplied type arguments and arguments."
It sounds like my scenario is not supported? Tried following dynamic linq extension guidelines here Extending Dynamic LINQ in Dynamic LINQ (dynamic-linq.net) but no luck. Any suggestions how to add my filtering into the filtering pipeline besides resetting Data property? Thank you!
I added a custom template to the column's filter. The datagrid has a LoadData delegate, which is where you can compute what to display on the grid based on the filters, sort and page.
<RadzenDataGrid Data="OnePageOfData" LoadData="MyLoadDataMethod"
PageSize="10" AllowPaging="true" Count="NumberOfDataItemsAfterFilter">
<Columns>
<RadzenDataGridColumn>
<FilterTemplate>
<MyFilterComponent @bind-Value="FilterValue" />
</FilterTemplate>
</RadzenDataGridColumn>
</Columns>
</RadzenDataGrid>
public void MyLoadDataMethod(LoadDataArgs args)
{
// apply filters
var query = MyData.AsQueryable();
if (!string.IsNullOrEmpty(args.Filter))
{
query = query.Where(args.Filter);
}
// do whatever custom filtering you want
// here for example let's assume FilterValue is an array
query = query.Where(e => FilterValue.Any(v => e == v))
// apply sorting
if (!string.IsNullOrEmpty(args.OrderBy))
{
query = query.OrderBy(args.OrderBy);
}
// Number of items and items on current page
NumberOfDataItemsAfterFilter = query.Count();
OnePageOfData = query.Skip(args.Skip.Value).Take(args.Top.Value).ToList();
}