onActiveDayClick not firing for active days added after initial load

Issue #41 new
Former user created an issue

Active days that are added via the .responsiveCalendar('edit',{}) function (or the editDays function directly on the Calendar object) do not get assigned the click event - the one that's called in the setEvents function and is called when the calendar is drawn.

Here's the situation:

  • I'm loading the calendar with no initial events
  • I'm using a jQuery ajax call to fetch events from the server, using the Calendar object as context
  • In my callback, this now refers to the Calendar object, where I make a direct call to editDays() to add the events to all the days that are specified in the callback
  • Although a onActiveDayClick function is specified in the initialization options, this function is not ran.
  • onDayClick does work, as when the setEvents function is called, all the days in the calendar are already populated, thus the click() event is registered.

Possible solution?

In the makeActive() function (or similar function), register the click() event to fire the onActiveDayClick defined in options for the now-active day .

Workarounds

In the onDayClick function, a simple check for .active on the event in question is a viable work around.

Comments (1)

  1. Log in to comment