javascriptfullcalendarwebix

JavaScript fullCalendar updateEvent gives "not a function"


..fighting fullCalendar, basically working OK, only giving issues when updating an event title with calendar.fullCalendar('updateEvent', oEvent).

The basics with display, render, drop events work perfect fine, only the calendar.fullCalendar('updateEvent', oEvent) always returns "Uncaught TypeError: calendar.fullCalendar is not a function". Even though 2 lines further up a calendar.getEventById( cEvId ); works perfect fine.

The specific code here:

eventDrop: function(arg) { 

    var cEvId = arg.event._def.publicId;
    
    var oEv = calendar.getEventById( cEvId );
    
    oEv.title = "Dropped";
    
    calendar.fullCalendar('updateEvent', oEv);     //<------------- Throws error " calendar.fullCalendar is not a function"
    
    console.log('eventDrop', cEvId, oEv, arg.event);
    
}

Again, all else I did works fine, I do not use JQuery, but use Webix library. fullCalendar files are included and in the end of the header of all includes.

Also e.g. this.fullCalendar(), as it is in a calendar event, gives the same "not a function" error.

I noticed a number of solutions for a problem like this, but they where involving JQuery, so do not apply here.

Any thoughts would be very much appreciated.


Solution

  • Thanks to @ADyson for the right solution:

    calendar.fullCalendar really isn't a function - tell me if you see it anywhere in the documentation at fullcalendar.io/docs#toc? I think maybe you have found an example from an older version, because you might have written in that way in v3. But not in v4 or v5. If you want to update events then then you can read about the available functions here: fullcalendar.io/docs/event-model