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

Filter on DateTime Column

3 Answers 251 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 28 Jul 2014, 02:49 PM

 Hello, 

I am working on a project with a RadGrid.
One column is a Date/DateTime type.

When I execute an “EqualTo” filter, even though I enter a full date and time value, the time disappears. Therefore, the filter
is executed just with the date value and does not give me the correct results.

Please see the following video:
[Video Link]

Here are my questions:

  • How can I fix this problem?
  • How can I add the filter option “contains”?
  • How can I get results inside a time range (between two dates)? 

Thank you,
Daniel.

3 Answers, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 31 Jul 2014, 10:49 AM
Hello Daniel,

By default the grid will filter the DateTime objects by only taking the date part. However if you set the EnableTimeIndependentFiltering property of the GridDateColumn to true you should be able to filter by the time part as well. In attachments you can find a sample website that filters the date as per the requirements.

As for applying filtering by a given time range you can set the EnableRangeFiltering of the date column to true.

Please modify the real code logic according to the above suggestions and let us know of the results.

Regards,
Angel Petrov
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.

 
0
Daniel
Top achievements
Rank 1
answered on 03 Aug 2014, 12:12 PM
Hi Angel Petrov,

Thank you for your response.

Unfortunately, the answer does not satisfy the requirements of my project: 
  1. According to the answer, a filter applies only to the date and not to the time. - See video.
    How it is possible to filter by hour too? 
  2. You showed me the option of EnableRangeFiltering, where the user must fill-in the two fields (“From” and “To” text-boxes).
    The project requires that the user could also insert only one value field. For example, if the user only enters a value in the “From” text-box, then display all the records which are from that date and on.
  3. How can the user filter a DateTime with part of the date / time? For example, how to filter  data only from 2013 or display data from a certain hour (regardless of date). 

I'd love to get a solution for any of these problems.

 Thank you,
Daniel.

0
Angel Petrov
Telerik team
answered on 07 Aug 2014, 06:38 AM
Hi,

Regarding the requirements listed in the ticket.

I want to apologize for misleading you in my previous post about the first one. Actually the correct approach here is to set a FilterDateFormat string so that the time part of the date does not get escaped. Attached is a modified version of the previously provided example which now seems to work as expected.

As for the second and third requirements I have to say that such functionality is currently not supported. If it is mandatory for your project I suggest logging a feature request in our feedback portal so our developers can research the matter and integrate a built-in solution if possible.

Regards,
Angel Petrov
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
Daniel
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Daniel
Top achievements
Rank 1
Share this question
or