Announcement

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

    Calendar Date Chooser showing years from 1995 to 2020 only

    SmartGWT version - 6.0p build date - 2020-06-11
    Browser - Google Chrome version-83.0.4103.9

    In Calendar widget, date chooser shows only years from 1995 to 2020 only. Not able to move the year to 2021 when I click on single right arrow button.

    Code to create Calendar Widget:

    Calendar calendar = new Calendar();
    calendar.setDisableWeekends(false);
    calendar.setShowAddEventButton(false);
    calendar.setCanEditEvents(true);
    calendar.setEventAutoArrange(true);
    calendar.setEventOverlap(true);
    calendar.setEventOverlapPercent(5);
    calendar.setEventOverlapIdenticalStartTimes(true);
    calendar.setShowQuickEventDialog(false);
    calendar.setShowOtherDays(false);

    Do I have to set any other property to show years beyond 2020? Could you please share sample code for that?

    Thanks in advance.
    Attached Files

    #2
    6.0 is quite an old release and the default DateChooser range dates reflect that. You could change them via the Calendar.dateChooser autoChild - the settings are startYear and endYear.

    But note that all DateChoosers in your project will have the same range you mentioned, so you probably want to change them all at once - you can do that via DateChooser.setDefaultProperties().

    Comment


      #3
      Thank You. Are there any code snippets?

      I am getting like

      calendar.getDateChooser().setDefaultProperties(dateChooserProperties);

      (or)

      calendar.getDateChooser().setStartYear(startYear);
      calendar.getDateChooser().setEndYear(endYear);

      Little confused over how to use the methods properly
      Last edited by mkmmkandan; 23rd Jun 2020, 04:39.

      Comment


        #4
        This will change the range globally, for all DateChoosers - do this before you create any widgets.

        Code:
        DateChooser props = new DateChooser();
        props.setStartYear(year);
        props.setEndYear(year);
        DateChooser.setDefaultProperties(props);

        Comment

        Working...
        X