最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Get fullcalendar fc-event div by id - Stack Overflow

programmeradmin1浏览0评论

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 acplish 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?

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 acplish 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?

Share Improve this question asked Nov 4, 2013 at 19:27 Ryan MitchellRyan Mitchell 1,4101 gold badge14 silver badges23 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

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./fullcalendar/docs/event_rendering/eventRender/

发布评论

评论列表(0)

  1. 暂无评论