Announcement

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

    Set shown period in calendar

    I'm trying to find out how to set the dates to be shown in a calendar month view.

    I have 2 calendars (see attached) similar to the compact calendar in the showcase, but only the first calendar has previous and next buttons. I want the 2nd calendar to always show the month after the month being shown in the first calendar so that both calendars change month when I press next/previous on the first calendar.

    I have added a DateChangedHandler to the first calendar and I want to use that to alter the dates being shown in the 2nd calendar but I cant't figure out how. Am I missing something obvious?

    Also when not showing the previous and next buttons on the 2nd calendar the month name is not centered in the same place as the first calendar, how can I change that?
    Attached Files

    #2
    It seems like calling calendar2.setChosenDate(calendar1.getChosenDate()) from your handler will probably do it. Did you try that?

    Comment


      #3
      Ahh that's the one I was looking for :) Works like a charm, thanks.

      I have another small question. How do I change what the weekdays are called? I want to change it from Mon, Tue to M, T and so forth.

      Comment


        #4
        Currently, the headers in the weekView show the result of a call to DateUtil.getShortDayName() - by default, this call returns the first 3 characters of an entry from the system-wide array of localized shortDayNames - at the moment, there's no hook that would allow you to override that behavior for a Calendar.

        Again, it's something we could add if you need it.

        If this is new Calendar work, it might be worth dropping a note to Isomorphic Support, with a brief list of the features you need - we can let you know broadly what's already supported and what isn't.

        Comment


          #5
          Actually - looking again at your image, it's not really clear if you need to use Calendars at all...

          A DateChooser might be more appropriate, depending on what you're doing with it, and DateChoosers should already support this.

          Comment


            #6
            Well it needs to be databound so I'm guessing a DateChooser would not be the best for that.

            The reason I need to change the daynames is because they cant fit in the size I need for the calendars.

            Also can you point me in the direction of how I can properly center the month title on the 2nd calendar? I'm guessing some autochild magic but I'm not sure how.
            Attached Files

            Comment


              #7
              Ok - on changing the header text for date fields in the monthView - you can actually do this as-is via the autoChild system - something like, create a CalendarView, override getFieldTitle() on it, and then pass it to Calendar.setAutoChildProperties("monthView", viewProperties).

              On your other point about centering the stuff in the controlsBar - we've just made change to fix that and it will hit builds as of August 30.

              Comment


                #8
                Thank you, but I don't see a getFieldTitle() in CalendarView.

                Comment


                  #9
                  It's inherited from ListGrid.

                  Comment


                    #10
                    I don't see it there either. https://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/widgets/grid/ListGrid.html has no mention of getFieldTitle.

                    Comment


                      #11
                      hm - yes, you're right, it's not exposed to SGWT, unlike the method with the same name on ListGridField.

                      We'll look at exposing ListGrid.getFieldTitle(), after a quick audit, and update here when we have more information.

                      Comment


                        #12
                        Any updates on exposing ListGrid.getFieldTitle()?

                        Comment


                          #13
                          Yes, it's being added even as we speak - it will be in tomorrow's builds.

                          Comment


                            #14
                            After updating to SmartClient Version: v10.0p_2015-09-19/Pro Deployment (built 2015-09-19) I still dont see ListGrid.getFieldTitle() anywhere.

                            Comment


                              #15
                              Sorry about that - the method had been updated and re-doc'd for exposure, but had not actually been exposed - we just made that change - please retry with tomorrow's build.

                              Comment

                              Working...
                              X