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

DateTimeOffset column filtering and sorting

1 Answer 368 Views
Grid
This is a migrated thread and some comments may be shown as answers.
UPG plc
Top achievements
Rank 1
UPG plc asked on 14 Aug 2014, 09:29 AM
Hi,

I am currently following the advice in this thread http://www.telerik.com/forums/using-datetimeoffset-in-column-filter in order to display datetimeoffset data in a grid. My questions are:

1) Are there plans to implement native support for the datetimeoffset type? It is a useful type for uniquely identifying a point in time above what datetime offers, so would be a useful type to support. The current solution seems a bit of a hack and native support would be much better.

2) Do I need to add any additional code to support columns sorting of datetimeoffsets as well as filtering? At present I am converting the datetimeoffsets to datetimes in my viewmodel to get around this issue.

My current code is as follows. The MapFilters function is as in the previous post. Should I be implementing a MapSorts function too? If so what would this look like?

Regards,

Michael
public ActionResult LogEntries_Read([DataSourceRequest] DataSourceRequest request)
{
    try
    {
        using (var db = new SysLogContext())
        {
            // convert datetimeoffsets to datetimes in the filters and sorts since Kendo does not support datetimeoffset
            if (request.Filters.Any())
            {
                request.Filters.MapFilters(descriptor =>
                {
                    if (descriptor.Member == "Date")
                    {
                        descriptor.Value = new DateTimeOffset((DateTime) descriptor.Value);
                    }
                });
            }

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 18 Aug 2014, 08:03 AM
Hello Michael,

Adding support for DateTimeOffset is not currently planned. I can suggest to submit a feature request in our user voice forum.
No additional code should be required to handle the sorting because no value is posted for the sort operation.

Regards,
Daniel
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
UPG plc
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or