Filter on DateTime Column

4 posts, 0 answers
  1. Daniel
    Daniel avatar
    159 posts
    Member since:
    Feb 2014

    Posted 28 Jul 2014 Link to this post

     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.

  2. Angel Petrov
    Admin
    Angel Petrov avatar
    1031 posts

    Posted 31 Jul 2014 Link to this post

    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.

     
  3. Daniel
    Daniel avatar
    159 posts
    Member since:
    Feb 2014

    Posted 03 Aug 2014 in reply to Angel Petrov Link to this post

    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.

  4. Angel Petrov
    Admin
    Angel Petrov avatar
    1031 posts

    Posted 07 Aug 2014 Link to this post

    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.

     
Back to Top