Announcement

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

    Setting startDate/endDate for MiniDateRangeItem

    Hi,

    I'm using smartGWT version 2.5 and have a following problem with MiniDateRangeItem item - when datasource allows handling of advance criteria, date listgrid field has rendered MiniDateRangeItem in filter editor.
    This item contains from and to items with date pickers, when user clicks on some of that picker, calendar is opened and in that calendar user can select year from range of years, by default this range is from 1995 to 2015 that is too small from properties like birth date of person.
    I'd like to increase this range (for example 1900-2010) but didn't find the way how it should be changed.
    in dateItem it can be easly achieved by:
    Code:
    setStartDate(new DateMidnight(1900, 1, 1).toDate());
    setEndDate(new Date());
    but MiniDateRangeItem doesn't contain such properties, how it's possible to change that range in MiniDateRangeItem?

    thanks,

    Michal

    #2
    Are you trying to set this system-wide (all RelativeDateItems)? If so, the following JSNI snippet will do this:

    Code:
    $wnd.isc.RelativeDateItem.addProperties({
       startDate:new Date(1900,1,1),
       endDate:new Date(2015,1,1)
    })

    Comment


      #3
      thanks, that works
      I previously added that properties to other elements.

      michal

      Comment


        #4
        Where should I add these lines please?

        $wnd.isc.RelativeDateItem.addProperties({
        startDate:new Date(1900,1,1),
        endDate:new Date(2011,1,1)
        })

        Thanks,
        Mohammad

        Comment


          #5
          Hi,

          can you explain/document the preferred way (in SmartGWT) of setting the maximum date ranges? Still with JSNI?

          I've seen a few defaults which get set hardcoded already:
          Code:
          endDate:isc.DateItem.DEFAULT_END_DATE
          endYear:2015,
          DEFAULT_END_DATE:Date.createLogicalDate(2015, 11, 31),
          Since it's already end of 2013, we'll have more chance dates after the year 2015 will be used.

          For dates in the far future, I do expect someone just typing in the date, rather than clicking the next year button 30 times, so no need to span 100 years :)


          TIA,

          Comment


            #6
            You can now use setDefaultProperties() to do this entirely in Java.

            Comment


              #7
              Sorry for not getting this, but calling setDefaultProperties() on what class? Can you be more specific? (I think i'm missing something obvious here :-))

              i'd like to extend the end date to around 2020 (system-wide).

              Comment


                #8
                Hello,

                to extend the end date of the MiniDateRangeItem you have to call the setDefaultProperties() method of the class RelativeDateItem like this:

                Code:
                RelativeDateItem defaultProperties = new RelativeDateItem();
                defaultProperties.setEndDate(new Date(1,1,2020));  
                RelativeDateItem.setDefaultProperties(defaultProperties);
                I hope this helps you.

                Regards,
                David

                Comment

                Working...
                X