Kendo grid mvc filterable option for column nested property

1.4k views Asked by At

I am using asp.net core MVC kendo grid column with a nested property.I have column "CreatedDate" of type datetime but i want to use only date part from the property like "CreatedDate.Date". I have applied filterable option for column "CreatedDate" and it is working fine.

   columns.Bound(c => c.CreatedDate).Title("Created On")
    .Filterable(x=>x.Operators(d=>d.ForDate(o=>o.Clear()
                  .IsGreaterThan("Is Greater Than") 
                    .IsLessThan("Is Less Than"))));

But when i apply filterable option for the same column with nested property like "CreatedDate.Date" it is not working. All the filter option are showed in the list.

 columns.Bound(c => c.CreatedDateTimeUtc.Date).Title("Created On")
                       .Filterable(x=>x.Operators(d=>d.ForDate(o=>o.Clear()
                       .IsGreaterThan("Is Greater Than")
                          .IsLessThan("Is Less Than"))));

Am i missing anything to add for nested property to apply custom filterable option? Please help me out from this issue

1

There are 1 answers

0
Natalka On BEST ANSWER

I think Kendo doesn't filter complex objects out of the box. One option is to add the field to your view model so it's not complex anymore. Otherwise you can capture the filter event and take care of the filtering for that field in a javascript function.

This documentation might be helpful:

https://demos.telerik.com/aspnet-mvc/grid/events

https://docs.telerik.com/kendo-ui/knowledge-base/grid-filter-column-with-dropdownlist