Announcement

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

    #16
    Okay so I have tried to do as you suggested but it doesn't seem to be working.

    Code:
    CalendarView monthView = new CalendarView(){
        @Override
        public String getFieldTitle(String fieldId) {
            return "Test";
        }
    };
    
    monthView.setHoverWidth(250);
    calendar.setAutoChildProperties("monthView", monthView);
    With this code the calendar is still showing Mon, Tue, ... in the headers.
    The hoverWidth is correctly changed to 250 so the autochild properties must be applied somehow.

    Comment


      #17
      Isomorphic did you see this? Am I doing something wrong or why won't this work?

      Comment


        #18
        Yes - unfortunately, we gave bad advice in suggesting this technique - setAutoChildProperties() is actually documented as not supporting overrides like this.

        We're considering adding a more direct mechanism to CalendarView and will update here when a decision is made.

        Comment


          #19
          We've added Calendar.setDateHeaderCustomizer(DateHeaderCustomizer) - this should allow you to customize the headers for date fields in any CalendarView (the view is passed in, along with the date, dayOfWeek and defaultValue).

          You can try this out in builds dated October 8 and later.

          Comment


            #20
            Okay so I have tried to set DateHeaderCustomizer for my calendar but I get some errors when the calendar is showing the monthView.

            I'm getting the following error 7 times (one for each column I think).
            Code:
            WARN:Log:Uncaught exception escaped: com.google.gwt.core.client.JavaScriptException
            (TypeError) : Cannot read property 'getTime' of undefined
                at wrap_1_g$(Exceptions.java:36)
                at apply_0_g$(Impl.java:247)
                at entry0_0_g$(Impl.java:300)
                at anonymous(Impl.java:72)

            DateHeaderCustomizer: (I also tried just returning defaultValue but I still get the errors so I don't think the switch is causing it.)
            Code:
                        calendar.setDateHeaderCustomizer(new DateHeaderCustomizer() {
                            
                            @Override
                            public String getHeaderTitle(Date date, int dayOfWeek, String defaultValue, CalendarView calendarView) {
                                switch (dayOfWeek) {
                                case 0:
                                    return "S";
                                case 1:
                                    return "M";
                                case 2:
                                    return "T";
                                case 3:
                                    return "W";
                                case 4:
                                    return "T";
                                case 5:
                                    return "F";
                                case 6:
                                    return "S";
                                default:
                                    return "";
                                }
                            }
                        });
            Last edited by Niels_EMP; 12 Oct 2015, 06:59.

            Comment


              #21
              Does it work if you just return the substring (first char) of the defaultValue?

              Comment


                #22
                No that doesn't work either.

                Comment


                  #23
                  This has been fixed for builds dated October 14 - it was a JSNI bug, where code tried to construct a Java Date from the associated JS date, which is null when this customizer is called from the MonthView.

                  With your current build, if you were to show the week view, you would see your customizer having an effect.

                  Comment


                    #24
                    Just tested with the new build and it works perfect, thanks.

                    Comment

                    Working...
                    X