Issue 2434: Easily get current Calendar context from callback methods
Status:  ExportedToGithub
Owner: ----
Closed:  Aug 2015
Reported by nlok...@gmail.com, Feb 5, 2015
I initialize two calendars on same page as below:
html
<div id="calendar1"></div>
<div id="calendar2"></div>

javascript
$("#calendar1, #calendar2").fullCalendar({
 .....
  events: function(start, end, timezone, callback) {
            var evt1=[{title:'A',start:'2015-02-01'}];
            var evt2=[{title:'B',start:'2015-02-01'}];

            calendarid = $(this);  <== how to get the id?

            if (calendarid = 'calendar1') { callback(evt1); }
            if (calendarid = 'calendar2') { callback(evt2); }                       

  }, // end of events
 .....
}

I initialize two calendars on same page as below:

html

<div id="calendar1"></div>
<div id="calendar2"></div>
javascript

$("#calendar1, #calendar2").fullCalendar({
 .....
  events: function(start, end, timezone, callback) {
            var evt1=[{title:'A',start:'2015-02-01'}];
            var evt2=[{title:'B',start:'2015-02-01'}];

            calendarid = $(this);  <== how to get the id?

            if (calendarid = 'calendar1') { callback(evt1); }
            if (calendarid = 'calendar2') { callback(evt2); }                       

  }, // end of events
 .....
}
Each calendar got its own set of events. How can I know the selector id inside the events function? Hope that fullCalendar expose the selector id in the events function(start, end, timezone, callback, calendarid) {...}
Feb 9, 2015
Project Member #1 adamrs...@gmail.com
I eventually want to shift the API around to have every callback method have the `this` context be the current calendar object. Then you could execute your methods directly on that object.

But unfortunately the only solution right now is to initialize them separately.
Summary: Easily get current Calendar context from callback methods (was: How to identify selector id when initialize multiple Fullcalendar at one time?)
Status: Accepted
Labels: Type-Feature
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/2699

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