Hi, I'm trying to add new event dynamically in javascript code. I didn't be able to do it.
Can you help me please?
It should be nice to initialize the calendar in the html page instead of js file like in the downloaded theme.
Thank you in advance
Hi,
The calendar events must be added by the API methods in Javascript since the calendar is rendered and initialized in javascript. In src/js/custom/apps/calendar/calendar.js
you can find handleNewEvent
function and refer to the below code that adds a new event:
// Add new event to calendar
calendar.addEvent({
id: uid(),
title: eventName.value,
description: eventDescription.value,
location: eventLocation.value,
start: startDateTime,
end: endDateTime,
allDay: allDayEvent
});
initCalendarApp
function you can see events
parameter to pass events for calendar rendering. For more info please check the Fullcalendar documentation.