This is a migrated thread and some comments may be shown as answers.

Filter Broken for DateTimeOffset Column

1 Answer 385 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aleks
Top achievements
Rank 1
Veteran
Aleks asked on 04 Feb 2021, 11:30 PM

When using a date filter on a column bound to a DateTimeOffset property, the filter is missing all its options.

The property:

public DateTimeOffset Created { get; set; }

 

The column definition:

c.Bound(x => x.Created)
.Filterable(f => f
.Operators(o => o.ForDate(d => d.Clear().IsGreaterThanOrEqualTo("On or after").IsLessThan("Before")))
.Extra(true)
.UI(GridFilterUIRole.DateTimePicker)
);

 

When the property type is changed to DateTime, the filter works as expected.

See the attached images. (The operator dropdown just shows "NO DATA FOUND").

No errors are reported in the console.

Using:

<PackageReference Include="Telerik.UI.for.AspNet.Core" Version="2021.1.119" />

    "@progress/kendo-theme-bootstrap": "^4.30.0",
    "@progress/kendo-theme-default": "^4.32.0",
    "@progress/kendo-ui": "^2021.1.119",

 

1 Answer, 1 is accepted

Sort by
0
Patrick | Technical Support Engineer, Senior
Telerik team
answered on 09 Feb 2021, 04:27 PM

Hello Aleks,

In order to use the DateTimeOffSet within a Kendo UI Grid, the property will need to be mapped to a view model of type DateTime.  We have a dedicated Kendo UI Knowledge Base Article regarding how to resolve this as well as a runnable GitHub example which demonstrates one way to do this.    

Once the ViewModel containing the DateTime property is utilized, the filtering works as expected in the Kendo UI Grid:

I hope this information helps.  Please let me know if you have any questions regarding the matter.

Regards,
Patrick
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
Aleks
Top achievements
Rank 1
Veteran
Answers by
Patrick | Technical Support Engineer, Senior
Telerik team
Share this question
or