sanjeev07 / fullcalendar-reactWrapper

17 stars 19 forks source link

Receiving "Attempting to call a FullCalendar method on an element with no calendar" when trying to change view #12

Closed nlyn closed 6 years ago

nlyn commented 6 years ago

I'm trying to use the changeView action from inside the dayClick method, however the calendar isn't being recognized on the element it was initialzed on.

Here's my code:

          id='calendar'
          ...
          dayClick={(date, jsEvent, view) => {
            if (view.name === 'month') {
              // Clicked on the day number
              $('#calendar')
                .fullCalendar('changeView', 'agendaDay'/* or 'basicDay' */)
                .fullCalendar('gotoDate', date.year(), date.month(), date.date());
            }
          }}

When this code runes I get the following warning in the console:

Attempting to call a FullCalendar method on an element with no calendar.
nlyn commented 6 years ago

Managed to fix it following the advice from here:

https://github.com/sanjeev07/fullcalendar-reactWrapper/issues/1