Announcement

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

    RelativeDateItem Block Entering an End Date Sooner than Start Date

    SmartGWT 3.1p
    GWT 2.4
    FF 17.0.2 ESR
    ---

    In the SmartGWT 3.1p Showcase, it demonstrates a DateRangeItem that when the Filter button is clicked, it validates the DateRangeItem to see if the dates are consistent, such as the End Date is not sooner than the Start Date. I am not quite sure how that works but I believe it has something to do with the call to grid1.fetchData(..).

    How do you accomplish the same thing for individual RelativeDateItems where the first one is a "Start" RelativeDateItem and the second is an "End" RelativeDateItem? It is trivial to see if two dates are within a certain range in Java, however how can you cause the RelativeDateItem to show the error icon and text like in the Showcase Sample called "Date Range Filtering"?

    #2
    I have tried setting the same criteria field on each of my RelativeDateItems and then I set operators (GREATER_OR_EQUAL and LESS_OR_EQUAL).

    I am not tied to a DataSource or ListGrid.

    How can I get the dates to evaluate on the criteria? I have set validation on change to true.

    Comment


      #3
      In your ChangedHandler, you can extract the dates, do a little quick comparison, and then if the End date is before the Start date, simply call:

      Code:
      theEndDateItem.getForm().setFieldErrors(END_DATE_ITEM_NAME, "Date cannot be before Start", true)

      Comment

      Working...
      X