Announcement

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

    Styling calendar events

    I want to be able to style certain calendar events in the month view to be block display with a different background color, things like that. Using CalendarEvent.setEventWindowStyle() doesn't affect the HTML of the month view at all (the CSS class is not added), so then a coworker suggested overriding Calendar.getDayBodyHTML(), like in the compact calendar example in the showcase. That works fine for changing the display, but seeing as you're just outputting raw HTML, it loses the event handling functionality, so nothing happens when you click on the event. Do I just need to copy the HTML SmartClient is outputting, with the Javascript link? Seems like a fragile solution that breaks the GWT paradigm. Any chance of just having setEventWindowStyle() affect month view as well?

    #2
    There are separate month styles (dayHeaderBaseStyle, dayBodyBaseStyle et al).

    Comment


      #3
      But those only seem to affect the display of the calendar date, not the events themselves, right? I've attached an image that shows what I was trying to do.
      Attached Files

      Comment


        #4
        Ah that makes sense. There is a modifiable CSS style for this ("calMonthEventLink") but there's not a dynamic way to change it per-event yet. We'll add that capability - it looks like you're going to make heavy use of the Calendar so please consider sponsoring whatever batch of enhancements you might need to make maximum use of the Calendar.

        Comment


          #5
          Not sure yet if we'll end up sponsoring or not, but when you do implement it, either way, consider putting each event in a div to separate them instead of using br tags between them - it will make styling a lot easier.

          Comment


            #6
            I've been able to change the background color and header color and text color and font just fine using CSS and CalendarEvent.setEventWindowStyle(). Just copy calendar event part of the stylesheet included in one of the skins, rename it and make sure that the html that loads your calendar application loads that style sheet as well.

            Comment


              #7
              You've been able to change it in the month view?

              Comment


                #8
                I could not get it to change in month view but in other two views, yes.

                The problem is that the style can not be changed while in the Event call as in OnEventClick etc UNLESS one does total refresh (setData(...) etc).

                That is very expensive operation. I am having difficulty showing a selected Event by clicking it........

                Comment

                Working...
                X