Please enable JavaScript to view this site.

Navigation: Advanced topics > Events > Table events > Calendar page

Javascript Create Calendar

Scroll Prev Next More

Description

The CalendarCreate event occurs before a Calendar is created. Use this event to modify the Calendar settings.

Syntax

CalendarCreate(calendarElement, settings, proxy, pageObj)

Arguments

calendarElement

DOM element where Calendar will be created.

settings

Calendar control settings

proxy

data transferred from PHP code using setProxyValue function.

pageObj

an object representing the current page. For more information, see RunnerPage class.

Applies to pages

Calendar

 

Official FullCalendar component documentation: https://fullcalendar.io/docs

Examples

Example 1. Set business days and hours.

settings.businessHours = {
// days of week. An array of zero-based day of week integers (0=Sunday)
 daysOfWeek: [ 1, 2, 3, 4, 5 ], // Monday - Friday
 startTime: '10:00', // a start time (10am in this example)
 endTime: '18:00', // an end time (6pm in this example)
};
return new FullCalendar.Calendar( calendarElement, settings );

Example 2. Set the initial view to 'Week'.

settings.initialView = 'timeGridWeek';
 
return new FullCalendar.Calendar( calendarElement, settings );

Example 3. Add 'Day' view

 

By default Calendar has the following buttons in the center of the toolbar: Year, Month, Week, and List. Here is how we can also add 'Day' button there.

 

 

settings.headerToolbar = {
left: "title",
center: "dayGridYear,dayGridMonth,timeGridWeek,timeGridDay,listYear",
right: "prev,next today"
};
 
return new FullCalendar.Calendar( calendarElement, settings );

See also:

Creating Calendars

Calendar settings

 

Created with Help+Manual 7 and styled with Premium Pack Version 3 © by EC Software