public class Order
{
public int Id { get; set; }
public string Name { get; set; }
ICollection<OrderDetail> OrderDetails { get; set; }
}
public class OrderDetail
{
public int Id { get; set; }
public string Code { get; set; }
public int OrderId { get; set; }
public Order Order { get; set; }
}
Unfortunately Radzen Grid does not support filtering on child entries' properties, so I can't search for orders where order details have specific codes while in Order grid.
My idea of a workaround was to create a custom RadzenDataFilter< Order > which'd output LINQ-compatible OrderDetails filter string via .ToFilterString() that I'd feed to Order grid, however I am again not sure how to have this filter work with child collection.
Any suggestion or workaround is appreciated.
Overall adding a child collection filter support looks to be a great addition to Radzen.
SELECT
[x].[Id],
[x].[Name]
FROM
[Order] [x]
WHERE
EXISTS(
SELECT
*
FROM
[OrderDetail] [od]
WHERE
[x].[Id] = [od].[OrderId] AND [od].[Code] LIKE N'0%' ESCAPE N'~'
)
WorkStatuses is a property of parent as well, not child. There are no children in this demo.
And moreover the makeshift 'WorkStatuses' array can exist only in demo where the collection is initialized in code and it not comes from db. I can't imagine a real life scenario when such an IQueryable with array exists (except maybe in MongoDB)
This approach won't generate the following filter string: "OrderDetails.Any(Code.StartsWith("0"))"
However I noticed that filtering occurs only when the grid has Data property specified. If the LoadData method is used instead, then LoadArgs.Filter is empty and completely ignores any input from OrderDetails column.