Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get fullcalendar fc-event div by id

I'm working on an app that uses fullcalendar and displays Bootstrap popovers on events when they're clicked. This calendar is periodically refreshed with data from the server, retrieved by a poll. The problem I'm running into is that whenever this poll happens while a popover is active, all the events are rerendered and the div the popover was previously pointing to is orphaned, causing problems with our popover logic (scrolling, making sure only one popover is active at a time, etc).

One way to get around this is to remember which event had a popover active before the refresh and then just reattach the popover after the events have rerendered. Getting the ID of the event that needs the popover is no problem, but I can't seem to find a way to query fullcalendar for the fc-event div associated with a given event ID. The docs don't seem to contain any methods that would accomplish this, and looking through the source hasn't turned up anything that looks like it would help.

Does anybody know a way to do this - to get fullcalendar to return the fc-event div for a certain event, given the event's ID? Have I overlooked something obvious?

like image 573
Ryan Mitchell Avatar asked Nov 04 '13 19:11

Ryan Mitchell


1 Answers

You could just set the event-id as a data-attr on the element when the data is refreshed. Then it's simple jQuery-logic to find the event when the data is refreshed.

You have a method eventRender you can use for this.

http://arshaw.com/fullcalendar/docs/event_rendering/eventRender/

like image 81
loddn Avatar answered Oct 11 '22 14:10

loddn