FullCalendar-提取显示的事件 [英] FullCalendar - extract displayed events
问题描述
是否可以从FullCalendar对象中发现/提取当前显示的事件(请参阅: http://arshaw.com/fullcalendar )?
Is it possible to discover/extract the currently displayed events from the FullCalendar object, (ref: http://arshaw.com/fullcalendar)?
理想情况下,我希望在事件旁边有一个辅助显示,除了日历,它应该只显示当前显示的事件(例如,如果日历位于"2012年3月",我只想查看2012年3月的事件次要列表).
Ideally, I'd like a secondary display for events, alongside the calendar, which should show only the currently displayed events, (e.g. if the calendar is on "March 2012", I only want to see March 2012 events in the secondary list).
我猜想我会构造某种过滤器,但希望我可以直接将详细信息从日历中删除.我认为该插件必须已经建立并且可以显示...
I'm guessing I'll nedd to construct some sort of filter, but was hoping I might be able to pull the details straight back off the calendar. I figure the plugin must already have established which are valid for display...
任何我想念的功能/属性的指针,将不胜感激.
Any pointers to a function/property I've missed would be greatly appreciated.
推荐答案
是的,这很难做到.最近,我一直在研究FullCalendar,因为我一直在为自己的目的入侵大量额外功能.它不会以这种形式在内部存储信息,但是您可以通过一个小技巧来了解它:
Yes this is surprisingly hard to do. I've been digging around in FullCalendar a lot recently as I've been hacking a load of extra functionality into it for my own purposes. It doesn't store the information internally in that form but you can get at it with a small hack:
在第4243行插入(完整日历为1.5.2)
Insert at line 4243 (in fullcalendar 1.5.2)
t.eventResize = eventResize
//add starts
t.getShownEvents = function () {
evs = [];
for (id in eventElementsByID)
evs = evs.concat(eventsByID[id]);
return evs;
}
//add ends
然后执行此操作以获取当前正在显示的事件对象的数组:
Then do this to get an array of event objects currently being displayed:
var evs = $('#calendar').fullCalendar('getView').getShownEvents();
这篇关于FullCalendar-提取显示的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!