This new feature was something I was excited about. But I do not seem to get it to work. The Filter doesn't display anything when using a sub property. I also tried it in the demo.
Hi, thx for the quick response. I know it is not using the CheckBoxList, but you can alter it and run. I've been using this process several times to test things out.
That is why I posted the altered demo html to simulate. It gives the same results as in my application.
Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Specified method is not supported.
System.NotSupportedException: Specified method is not supported.
at Radzen.Blazor.DynamicLinqCustomTypeProvider.ResolveType(String typeName)
The demo code is not suitable for CheckBoxList type of filtering - setting simply this property will not work. You either need to update the code that applies Contains filter on first render or you need to remove it. For this code to work with CheckBoxList filter you need to update filter operator to In and the value to array of strings not plain string.
Thank you @enchev. Your suggestion fixed the above example.
However when the sub property is of type Enum it still does not work.
Please take a look at the following example. Filtering via "Color Name" (string) column works ok. Filtering via the column "Color Type" (Enum) is not working.
Is there something I need to change to get it to work?
@using System.ComponentModel.DataAnnotations
<RadzenDataGrid AllowPaging="true" AllowSorting="true" AllowFiltering="true" Data="@employees" FilterMode="FilterMode.CheckBoxList">
<Columns>
<RadzenDataGridColumn Property="@nameof(Employee.ID)" Title="ID" />
<RadzenDataGridColumn Property="@nameof(Employee.Gender)" Title="Gender" />
<RadzenDataGridColumn Property="@nameof(Employee.Status)" Title="Nullable Status" />
<RadzenDataGridColumn Property="Color.Name" Title="Color Name" />
<RadzenDataGridColumn Property="Color.Type" Title="Color Type" />
</Columns>
</RadzenDataGrid>
@code {
IEnumerable<Employee> employees;
public class Employee
{
public int ID { get; set; }
public GenderType Gender { get; set; }
public StatusType? Status { get; set; }
public MyColor Color { get; set; }
}
public class MyColor
{
public string Name {get; set;}
public ColorType Type { get; set; }
}
public enum GenderType
{
Ms,
Mr,
Unknown,
}
public enum ColorType
{
Red,
Green,
Blue,
[Display(Description = "Almond Green")]
AlmondGreen,
[Display(Description = "Amber Gray")]
AmberGray,
[Display(Description = "Apple Blue... ")]
AppleBlueSeaGreen,
//[Display(Description = "Miss", ResourceType = typeof(ResourceFile)] localization example
[Display(Description = "Azure")]
AzureBlue,
}
public enum StatusType
{
Inactive,
Active,
}
protected override void OnInitialized()
{
employees = Enumerable.Range(0, 10).Select(i =>
new Employee
{
ID = i,
Gender = i < 3 ? GenderType.Mr : i < 6 ? GenderType.Ms : GenderType.Unknown,
Status = i < 3 ? StatusType.Active : i < 6 ? StatusType.Inactive : null,
Color = i < 2
? new MyColor { Name = "Red", Type = ColorType.Red }
: i < 4
? new MyColor { Name = "Almond Green", Type = ColorType.AlmondGreen }
: i < 6
? new MyColor { Name = "Apple Blue Sea Green", Type = ColorType.AppleBlueSeaGreen }
: new MyColor { Name = "Azure Blue", Type = ColorType.AzureBlue },
});
}
}