My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 2441: Docs for eventRender/eventAfterRender, make clear that they are called once for each segment
2 people starred this issue and may be notified of changes. Back to list
Status:  ExportedToGithub
Owner:  ----
Closed:  Aug 2015


Sign in to add a comment
 
Reported by ma...@teachaway.com, Feb 11, 2015
View: agendaWeek
I have registered a callback on eventAfterRender.
Next I have rendered an event on the agendaWeek view via renderEvent.
The rendered event starts exactly "Now" and ends exactly "Tomorrow", using moment() and moment().add(1, 'days').
I expected the callback to be triggered once, since only one event got rendered.
The resulting behavior was however a double trigger of the callback. This happened because the rendered event spans across two columns in the agendaWeek table. If testing for an event that spans in three columns, the callback triggers three times, and so on.
Please check this bare-bones JS Bin replication of the behavior

http://jsbin.com/razequfofi/4/edit?html,css,js,output 
Feb 13, 2015
Project Member #1 adamrs...@gmail.com
That is by design. Each event "segment" (individual span of time after slicing) has its own element, and this callback is called once per segment. It allows DOM manipulation on each of these element instead of just the first. The other way to design the API is to pass in all the segment elements into one eventRender call (or eventAfterRender call) per event. But I think people seem to like and understand the existing approach.

The docs definitely need help describing this though. I will repurpose this ticket for that. Thanks for bringing this to my attention!
Summary: Docs for eventRender/eventAfterRender, make clear that they are called once for each segment (was: eventAfterRender callback fires multiple times when rendering an event that spans multiple columns in the agendaWeek view)
Status: Accepted
Labels: Type-Docs
Aug 21, 2015
Project Member #2 adamrs...@gmail.com
Discussion for this issue has moved to the following URL:
https://github.com/fullcalendar/fullcalendar/issues/2706

This is because Google Code is shutting down. Apologies if you are being pestered with these notifications. This is a one-time event.

Happy coding,
Adam
Status: ExportedToGithub
Sign in to add a comment

Powered by Google Project Hosting