FullCalendar - retrieve displayed events

Is it possible to detect / retrieve currently displayed events from a FullCalendar object, (ref: http://arshaw.com/fullcalendar )?

Ideally, I would like to see a secondary event display along with the calendar, which should only show the currently displayed events (for example, if the calendar is included in β€œMarch 2012”, I want to see the March 2012 events in the secondary list).

I suppose that I will not create some kind of filter, but I hoped that I could pull the details directly from the calendar. I believe the plugin is already installed, which is valid for display ...

Any pointers to the function / property that I missed are welcome.

+4
source share
3 answers

Yes, it is surprisingly difficult. Recently, I delved into FullCalendar many times, as I hacked into it additional features for my own purposes. It does not store information inside this form, but you can get it with a little hack:

Insert in line 4243 (in full calendar order 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 displayed:

 var evs = $('#calendar').fullCalendar('getView').getShownEvents(); 
+2
source

with version 2.x you can filter all client events loaded so far with the current scan interval Start and intervalEnd - I use the getIdOrFilter factory function to do this

 App.getIdOrFilter = function () { var view = $('#calendar').fullCalendar('getView'); var start = view.intervalStart; var end = view.intervalEnd; return function (e) { // this is our event filter if (e.start >= start && e.end <= end) { // event e is within the view interval return true; } // event e is not within the current displayed interval return false; }; } ... var events = $('#calendar').fullCalendar('clientEvents', App.getIdOrFilter()); 
+3
source

Thanks to James Ellis-Jones, I implemented this at the fork of full-text resource viewing and sent a transfer request to the owner of the Full Calendar resource.

https://github.com/stephenreid/fullcalendar/commit/808a0ac2ff8e9f900af263049cc95a7d4e2b6546

0
source

Source: https://habr.com/ru/post/1394508/


All Articles