Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easily get current Calendar context from callback methods #2699

Closed
arshaw opened this issue Aug 19, 2015 · 2 comments
Closed

Easily get current Calendar context from callback methods #2699

arshaw opened this issue Aug 19, 2015 · 2 comments
Labels

Comments

@arshaw
Copy link
Member

arshaw commented Aug 19, 2015

Originally reported on Google Code with ID 2434

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) {...}

Reported by nlok888 on 2015-02-06 04:20:56

Imported with 1 stars.

@arshaw
Copy link
Member Author

arshaw commented Aug 19, 2015

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.

Reported by adamrshaw on 2015-02-10 03:12:52

  • Status changed: Accepted
  • Labels added: Type-Feature

@arshaw
Copy link
Member Author

arshaw commented Jul 30, 2019

this is now implemented. in v4, all callbacks have their this value set to the Calendar instance

@arshaw arshaw closed this as completed Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant