Fullcalendar doesn't render color when using eventRender

Posted by jaffa on Stack Overflow See other posts from Stack Overflow or by jaffa
Published on 2011-10-27T15:26:23Z Indexed on 2012/07/03 9:16 UTC
Read the original article Hit count: 273

Filed under:

When I set-up fullCalendar and set eventRender function callback, I want to set the color of the event depending if LeadId is null or not. But this doesn't seem to work even though the documentation says so: http://arshaw.com/fullcalendar/docs/event_data/Event_Object/#color-options

Is there any way to set the event color to change based on the data?

 calendar = $('#dayview').fullCalendar({
            ....
            timeFormat: 'HH:mm',
            columnFormat: {
                agendaDay: 'dddd dd/MM/yyyy'
            },
            eventClick: function (calEvent, jsEvent, view) {
                var leadUrl = "/Leads/" + calEvent.LeadId;
                window.location = leadUrl;
            },
            eventRender: function (event, element) {
                if (event.LeadId != null) {
                    event.eventColor =  "#B22222";
                    event.eventBackColor = "#B22222";                       
                }
            },

UPDATE:

This is really strange. The event has all my properties returned for the event off the server. element is just the DOM element for the event. When I drag/move the event to somewhere else in the calendar, the event turns red, and if I inspect the event object it now has color set to Red. So the question is why isn't it applying on the 1st render, but on subsequent renders (i.e. after move) the colour gets applied?

© Stack Overflow or respective owner

Related posts about fullcalendar