Announcement

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

    DateChooser Year Picker - setting years

    I'm using SmartGWT Pro 2.3 and the DateChooser. When you click on the years, you get a list of years from now to 20 years ago (2010 to 1990).

    Is there a way to get this to let you pick from now to years from now (2010 to 2030)?

    Thanks,
    Chris

    #2
    Yes - setStartDate() and setEndDate() to dates at the endpoints of that range.

    Comment


      #3
      Thanks, but there are no methods setStartDate() and setEndDate() on DateChooser. They do exist on DateItem, but not DateChooser.

      Is there another way to accomplish this?

      Comment


        #4
        Ah, sorry, on a DateChooser it's setAttribute("startYear", 2010), setAttribute("endYear", 2030), we'll add dedicated getter/setters.

        Comment


          #5
          Not to be a pain, but setAttribute() isn't visible from the DateChooser. The setAttribute() methods are protected in BaseWidget and not explicitly exposed in DateChooser.

          Dedicated getters/setters for this would be great. In the meantime, is there a way to do this via JSNI?

          Thanks!

          Comment


            #6
            Dedicated getters/setters should appear in the next nightly build. Otherwise, use JSNI to set the startYear/endYear properties on the JavaScriptObject available from getJSObj().

            Comment


              #7
              Originally posted by cjustice
              Not to be a pain, but setAttribute() isn't visible from the DateChooser. The setAttribute() methods are protected in BaseWidget and not explicitly exposed in DateChooser.

              Dedicated getters/setters for this would be great. In the meantime, is there a way to do this via JSNI?

              Thanks!
              For future reference, you can use this pattern if you need to call setAttribute.

              Code:
              DateChooser dateChooser = new DateChooser() { 
              {
                 setAttribute("startYear", 2010);
              }};

              Comment

              Working...
              X