FullCalendar EventRender Issue - fullcalendar

I'm trying to get popovers to display the event information using FulCalendar 3.9.0 JQuery 3.3.1 and Bootstrap 4.1.0. When I try replacing the following code:
eventClick: function(event) {
// opens events in a popup window
window.open(event.url, '_blank', 'width=700,height=600');
return false;
}
as demonstrated by this online demo with:
eventRender: function(eventObj, $el) {
$el.popover({
title: eventObj.title,
content: eventObj.description,
trigger: 'hover',
placement: 'top',
container: 'body'
});
},
The following code displays the events drawn from various Google Calendars without any issue before that change is made:
$(document).ready(function() {
// Initialise the main calendar instance
$('#fullcalendar-instance').fullCalendar({
googleCalendarApiKey: 'MyAPIkey',
eventSources: [
{
googleCalendarId: 'gCalID-1',
color: 'green', // an option!
textColor: 'black', // an option!
className: 'my-event-1'
},
{
googleCalendarId: 'gCalID-2',
color: 'blue', // an option!
textColor: 'black', // an option!
className: 'my-event-2'
},
{
googleCalendarId: 'gCalID-3',
color: 'orange', // an option!
textColor: 'black', // an option!
className: 'my-event-3'
}
],
header: {
left: 'prev,next today',
center: 'title',
right: 'prevYear,nextYear',
},
titleFormat: 'MMM YYYY',
dayNamesShort: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
bootstrapFontAwesome: {
close: 'fa-times',
prev: 'fa-angle-left',
next: 'fa-angle-right',
prevYear: 'fa-angle-double-left',
nextYear: 'fa-angle-double-right'
},
timezone: 'Europe/London',
defaultView: 'month',
themeSystem: 'bootstrap4'
})
});
No errors are displayed in the console as far as I can see.
It is just that all the calendar events fail to be displayed.
Any assistance would be appreciated.

Related

Fullcalender scheduler : cannot get start and end dates using js

I am a beginner in coding. Currently I'm working with Fullcalender's scheduler(free version). I cannot get the start and end dates using javascript. I tried many ways. Someone, please help!!
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
slotMinTime :'08:00:00', //start time to be shown in the grid
slotMaxTime : '19:00:00', //end time to be shown in the grid
height: '100%',
aspectRatio: 1.8,
editable: true,
now: new Date(),
scrollTime: '00:00',
headerToolbar: {
left: 'today prev,next',
center: 'title',
right: 'resourceTimelineDay,resourceTimelineTenDays,timeGridWeek,dayGridMonth,listWeek'
},
initialView: 'resourceTimelineDay',
views: {
resourceTimelineTenDays: {
type: 'resourceTimeline',
duration: { days: 10 },
buttonText: '10 days'
}
},
expandRows: true,
resourceAreaWidth: '10%',
resourceAreaHeaderContent: 'Machine',
resources: [
{ id: '1', title: '1' , eventColor: 'blue'},
{ id: '2', title: '7', eventColor: 'green' },
{ id: '3', title: '8', eventColor: 'orange' },
{ id: '4', title: '11', eventColor: 'red' },
{ id: '5', title: '9', eventColor: 'yellow' },
],
events :'pages/load.php',
selectable:true,
selectHelper:true,
select: function(start, end, allDay)
{
$('#start').val(start.format("Y-MM-DD HH:mm:ss")); // here is my issue
$('#end').val(end.format("Y-MM-DD HH:mm:ss"));
$('#add_Modal').modal('show');
});
calendar.render();
});
Is there anything wrong? How shall I get the start and end values. I tried this too.
var start = $.fullCalendar.formatDate(start, "Y-MM-DD HH:mm:ss");
var end = $.fullCalendar.formatDate(end, "Y-MM-DD HH:mm:ss");
I got it. It was
var title = info.event.title; //gives Thu Jul 30 2020 17:30:00 GMT+0900
var start =info.event.start;
Thank you all.

Fullcalendar - Google Calendar Events Not Displaying

Reference: fullcalendar and gcal both v.3.9.0, jquery v.3.3.1, moment v. latest
I'm trying to get a test calendar running to display multiple Google Calendars, but so far no events are being displayed. I've followed the documentation on the fullcalendar.io website but have had no success so far. The following code renders the calendar but does not display the Google Calendar events:
$(document).ready(function() {
function CalendarSource(label, googleCalendarId, name) {
this.label = label;
this.googleCalendarId = googleCalendarId;
this.name = name;
}
// Initialise the main calendar instance
$('#fullcalendar-instance').fullCalendar({
googleCalendarApiKey: 'MyAPIkey',
eventSources: [
{
googleCalendarId: 'gCalID-1',
color: 'green', // an option!
textColor: 'black', // an option!
className: 'my-event-1'
},
{
googleCalendarId: 'gCalID-2',
color: 'blue', // an option!
textColor: 'black', // an option!
className: 'my-event-2'
},
{
googleCalendarId: 'gCalID-3',
color: 'orange', // an option!
textColor: 'black', // an option!
className: 'my-event-3'
}
],
header: {
left: 'prev,next today',
center: 'title',
right: 'prevYear,nextYear',
},
titleFormat: 'MMM YYYY',
dayNamesShort: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
bootstrapFontAwesome: {
close: 'fa-times',
prev: 'fa-angle-left',
next: 'fa-angle-right',
prevYear: 'fa-angle-double-left',
nextYear: 'fa-angle-double-right'
},
timezone: 'Europe/London',
defaultView: 'month',
themeSystem: 'bootstrap4'
})
});
I would be grateful if someone could point out where I going wrong.
I rebuilt the page from scratch based upon the following demo:
http://started%20from%20sratch%20using%20the%20fullcalendar.io/releases/fullcalendar/3.9.0/demos/gcal.html

Fullcalendar - change event color on select

I'm trying to set a default title and background color when selecting an event on fullcalendar. but the event is customized only after rendering it and not during its selection. Any idea? thx for your help.
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultView: 'agendaWeek',
navLinks: true,
selectable: true,
selectHelper: true,
select: function(start, end) {
var eventData;
eventData = {
title: 'unavailable',
start: start,
end: end,
backgroundColor: 'red',
};
$('#calendar').fullCalendar('renderEvent', eventData, true);
$('#calendar').fullCalendar('unselect');
},
editable: true,
});
});
This is a jsfiddle

FullCalendar list-views, height: auto not working as expected

I'm using the demo list-views.html and trying to set height: auto, but this does not work! The Calendar has a vertical scrollbar.
$(document).ready(function() {
$('#calendar').fullCalendar({
height: 'auto',
header: {
left: 'prev,next today',
center: 'title',
right: 'listDay,listWeek,month'
},
// customize the button names,
// otherwise they'd all just say "list"
views: {
listDay: { buttonText: 'list day' },
listWeek: { buttonText: 'list week' }
},
defaultView: 'listWeek',
defaultDate: '2017-02-12',
navLinks: true, // can click day/week names to navigate views
editable: true,
eventLimit: true, // allow "more" link when too many events
events: [
{
title: 'All Day Event',
start: '2017-02-01'
},
***continue-demo
I have no idea if this will help but did you include the print.css? That may correct it. Also on the print css be sure to set media="" to media="print".

Fullcalendar jquery not working in wordpress

I am working on Fullcalendar selectable jquery. I need to use it in wordpress. I have created a template file and call the calendar div in template file and include css files "fullcalendar.css" and "fullcalendar.print.css" in header and "moment.min.js" and "fullcalendar.min.js" in footer. It is only showing calendar without any css effect and not working selectable event. Files are included correctly and not showing any javascript error. I am using this fullcalendar script. I have tried to deactivate all plugins.
jQuery(document).ready(function($) {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultDate: '2016-08-05',
theme: true,
selectable: true,
selectHelper: true,
select: function(start, end) {
var title = prompt('Event Title:'); alert(title);
var eventData;
if (title) {
eventData = {
title: title,
start: start,
end: end
};
$('#calendar').fullCalendar('renderEvent', eventData, true); // stick? = true
}
$('#calendar').fullCalendar('unselect');
},
editable: true,
eventLimit: true, // allow "more" link when too many events
events: [
{
title: 'All Day Event',
start: '2016-08-09'
},
{
title: 'Long Event',
start: '2016-08-07',
end: '2016-08-15'
},
{
id: 999,
title: 'Repeating Event',
start: '2016-06-09T16:00:00'
},
{
id: 999,
title: 'Repeating Event',
start: '2016-06-16T16:00:00'
},
{
title: 'Conference',
start: '2016-06-11',
end: '2016-06-13'
},
{
title: 'Meeting',
start: '2016-06-12T10:30:00',
end: '2016-06-12T12:30:00'
},
{
title: 'Lunch',
start: '2016-06-12T12:00:00'
},
{
title: 'Meeting',
start: '2016-06-12T14:30:00'
},
{
title: 'Happy Hour',
start: '2016-06-12T17:30:00'
},
{
title: 'Dinner',
start: '2016-06-12T20:00:00'
},
{
title: 'Birthday Party',
start: '2016-06-13T07:00:00'
},
{
title: 'Click for Google',
url: 'http://google.com/',
start: '2016-06-28'
}
]
});
});
My issue has been resolved.I was adding "fullcalendar.print.css" after "fullcalendar.min.css". When i commented "print.css" file then it started working fine.

Resources