Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Include time in date range grid filter

    I have a ListGrid with a field of type datetime and with filtering enabled. When clicking the calendar icon for this field, a "Select Date Range" dialog appears and I can choose a date range. I was wondering if there's a way to include the time in the parentheses on the right side (see attached image - of course the time font would match the date font and not be red)

    The reason is if the user wanted to select a range within one day, he/she would choose a range of a single day, say 11/16/2011 - 11/16/2011, thinking this would include the whole day. When I submit this, the dev console shows 11/16/2011 00:00 - 11/16/2011 00:00. It would be nice to have the time there to subtly indicate that there's not really a range.

    Thanks!
    Attached Files

    #2
    Actually, the behavior is that there *is* a range. The created criteria will be interpreted as including the entirety of the single selected day.

    Comment


      #3
      Thanks for your reply but I didn't see that behavior when I put in the same day. I wonder if it's because I'm using a client-only data source (for local filtering). I'm using SmartGWT 2.4 Power in Firefox 6.

      Comment


        #4
        More likely it's because as part of 2.5, we refined the date range filtering to be smarter about the start and end of the range and doing the right thing with respect to user expectations. If you can't upgrade immediately, please revisit this issue when you do upgrade (as it doesn't make sense to add 00:00 to 2.4, of course).

        Comment


          #5
          As much as I'd like to upgrade to 2.5, it'd be really hard to push for it right now because of approval reasons :(

          Is there any way to accomplish the single day filtering with 2.4 such as setting the default item properties on the filter editor?

          Comment


            #6
            2.5 has been out for a while and is very stable, and is also a no-cost upgrade from 2.4. It's wasted work, but you could add code that checks the criteria either server-side or via dataSource.transformRequest, and sends back an error message indicating that there's basically no range.

            Comment


              #7
              Thanks for the hint. I was able to override the transformRequest method to change the lessOrEqual criteria's value to the same day plus 24hrs minus 1ms.

              This worked for the first request but if the user changes the filter then changes it back to the first request's date range, a filter occurs instead of a DSRequest (as shown in the dev console). Is there a way to do a similar thing like overriding the transformRequest method when filtering? Not sure if it matters, but I'm using a client-only data source. Thanks!

              Comment


                #8
                Sorry, but fully round-tripping the criteria is very complicated with lots of edge cases. We recommend either moving to 2.5 or catching an empty range and providing an error message.

                Comment

                Working...
                X