Issue 787: EventRender callback bug?
Status:  Done
Owner: ----
Closed:  Jan 2011
Reported by mitchell...@gmail.com, Jan 7, 2011
Hello,

First, thank you for providing such an excellent plugin.  :)

I have a question regarding the 'eventRender' callback.  Suppose I have a calendar created like this:

    $('#calendar').fullCalendar({
        eventRender: function(event, element) {
            console.log('render fired again');
            return;
        },
        dayClick: function(date) {
            $('#calendar').fullCalendar('renderEvent', {title: "test", start: date}, true);
        }
    });

So, when I click on a day once, I get a new event put on my calendar and I see 1 console log message ('render fired again') appear 1 time.

Now, when I click on another day again, I expect to see a second event rendered and only 1 'render fired again' message (for the new event).

However, I actually see 2 messages, almost as if the plugin re-renders all other previous events when I add a new one to the calendar.  This trend continues as I add additional events in this manner.

It could be that I'm doing something wrong, but this behavior does not seem correct to me.

Thank you for your time!  Please contact me if you need additional information.
Jan 12, 2011
Project Member #1 althaus.it
Why shouldn't adding a new event triggering a re-render of the existing ones? Probably the layout of the events has to be changed.
Jan 12, 2011
#2 mitchell...@gmail.com
Hmm, well, when I think of 'eventRender' conceptually, I think of a single event that's being rendered.

Also, there is another method already in the API specifically related to re-rendering all the events on the calendar:

http://arshaw.com/fullcalendar/docs/event_rendering/rerenderEvents/
Jan 13, 2011
Project Member #3 althaus.it
I think rerenderEvents() is just a method you can call to force a rendering.
Jan 14, 2011
#4 mitchell...@gmail.com
Okay, I thought this was a 'bug' at first, but I think I just misunderstood how your API worked in general.  I was attempting to add some additional properties to events in the 'eventRender' method (including a GUID-like id) and every time 'eventRender' was called, my ids kept getting changed.  However, if I just handle my event construction outside of 'eventRender', then things work just fine.

So I think I just misunderstood the responsibility of 'eventRender' i.e. it is responsible strictly for drawing the event on the UI, but should not be used on concert with event object creation/manipulation...those things should happen outside of this hook.

Please feel free to close this issue.  Again, thank you for your time!
Jan 17, 2011
Project Member #5 althaus.it
(No comment was entered for this change.)
Status: Done