RadzenFilter on property in a nested list #1480

Closed
opened 2026-01-29 17:54:13 +00:00 by claunia · 4 comments
Owner

Originally created by @tale80 on GitHub (Nov 15, 2024).

Is your feature request related to a problem? Please describe.
We are trying to create a RadzenFilter to filter a property in a nested list. For example, we have this simplified data model

public class Product
{
    public Guid Id { get; set; }

    public List<ProductCountries> ProductCountries { get; set; }
}

public class ProductCountry
{
    public Guid ProductId { get; set; }
    public Guid CountryId { get; set; }
}

public class Country
{
    public Guid Id { get; set; }

    public string CountryName { get; set; }
}

What we try to achieve is to create a filter for our products on a market.
We can work with FilterTemplate to select the desired CountryId, but we can't achieve to filter on the ProductCountry.CountryId property

Describe the solution you'd like
What we do on another part of our app for a same purpose, can be to add a new Parameter on the RadzenDataFilterProperty (eg : SourceListProperty) and transform the CompositeFilterToFilterString method and generate the filter like that :

whereList.Add($"{column.SourceListProperty}.Any({GetColumnFilter(Datafilter, column, Datafilter.FilterCaseSensitivity == FilterCaseSensitivity.CaseInsensitive)})");

Describe alternatives you've considered
I see no other way to do that with the existing RadzenFilter

If you're agree, we can try to make the change and send a PR

Originally created by @tale80 on GitHub (Nov 15, 2024). **Is your feature request related to a problem? Please describe.** We are trying to create a RadzenFilter to filter a property in a nested list. For example, we have this simplified data model ``` csharp public class Product { public Guid Id { get; set; } public List<ProductCountries> ProductCountries { get; set; } } public class ProductCountry { public Guid ProductId { get; set; } public Guid CountryId { get; set; } } public class Country { public Guid Id { get; set; } public string CountryName { get; set; } } ``` What we try to achieve is to create a filter for our products on a market. We can work with `FilterTemplate` to select the desired `CountryId`, but we can't achieve to filter on the `ProductCountry.CountryId` property **Describe the solution you'd like** What we do on another part of our app for a same purpose, can be to add a new Parameter on the `RadzenDataFilterProperty` (eg : `SourceListProperty`) and transform the `CompositeFilterToFilterString` method and generate the filter like that : ``` csharp whereList.Add($"{column.SourceListProperty}.Any({GetColumnFilter(Datafilter, column, Datafilter.FilterCaseSensitivity == FilterCaseSensitivity.CaseInsensitive)})"); ``` **Describe alternatives you've considered** I see no other way to do that with the existing RadzenFilter If you're agree, we can try to make the change and send a PR
Author
Owner

@tale80 commented on GitHub (Nov 18, 2024):

@enchev your solution is good but this only work for enumerable property (multivalue binding). If we do that with a simple string property to let users defined their filters by adding filter add/or, it will not working

@tale80 commented on GitHub (Nov 18, 2024): @enchev your solution is good but this only work for enumerable property (multivalue binding). If we do that with a simple string property to let users defined their filters by adding filter add/or, it will not working
Author
Owner

@enchev commented on GitHub (Nov 18, 2024):

Sub properties can be filtering in two ways now:

  • Property="Product.ProductName"
  • Property="Products" FilterProperty="ProductName"
@enchev commented on GitHub (Nov 18, 2024): Sub properties can be filtering in two ways now: - Property="Product.ProductName" - Property="Products" FilterProperty="ProductName"
Author
Owner

@tale80 commented on GitHub (Nov 18, 2024):

ok will give it a try when it will be released, thanks for your answers and your very quick PR !

@tale80 commented on GitHub (Nov 18, 2024): ok will give it a try when it will be released, thanks for your answers and your very quick PR !
Author
Owner

@enchev commented on GitHub (Nov 18, 2024):

It's already released and the first demo of the DataFilter is updated with example. Try filtering by product name:
image
image

Filtering by employee last name is again by sub property:
image
image

@enchev commented on GitHub (Nov 18, 2024): It's already released and the first demo of the DataFilter is updated with example. Try filtering by product name: ![image](https://github.com/user-attachments/assets/1d567739-3bbd-4704-99ea-2a31a9331c08) ![image](https://github.com/user-attachments/assets/62d734e2-9e67-4931-898f-d37b2ff9ffbd) Filtering by employee last name is again by sub property: ![image](https://github.com/user-attachments/assets/823e6304-be0b-4fd2-a22b-d4fe408ae386) ![image](https://github.com/user-attachments/assets/c25cabc9-6423-4631-8efc-7e6552e4ee6f)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1480