I need your help.
I've implemented FullCalnedar Scheduler (free trial version) on my Salesforce sandbox as a Lightning Web Component but Scheduler cannot be initialized.
When I check the error on console with debug mode, it says "ReferenceError: Calendar is not defined at FullCalendarResourceTrial.initializationV5 (https://…}". I've already checked using console.log that variable ele is populated correctly by querySelector.
I'm very new to js and salesforce customization so there might be easy mistakes, but I appreciate if someone could help me solve this issue.
Thanks a lot!
JS
import { LightningElement } from 'lwc';
import { loadScript, loadStyle } from 'lightning/platformResourceLoader';
// Static resource of FullCalendar Scheduler v5.0.1
import SchedulerV501 from '@salesforce/resourceUrl/SchedulerV501';
export default class FullCalendarResourceTrial extends LightningElement {
IsFullCalenderInitialized = false;
renderedCallback(){
if (this.IsFullCalenderInitialized) {
return;
}
this.IsFullCalenderInitialized = true;
this.loadScriptsByPromiseV5();
}
loadScriptsByPromiseV5(){
Promise.all([
loadScript(this, SchedulerV501 + '/lib/main.js'),
loadStyle(this, SchedulerV501 + '/lib/main.css')
])
.then( () => {
this.initializationV5();
})
.catch(error => {
console.error({
message: 'Error occured on FullCalendarScheduler',
error
});
});
}
initializationV5(){
let ele = this.template.querySelector('div.calendarmain');
var calendar = new Calendar(ele, {
initialView: 'resourceTimelineWeek',
});
calendar.render();
}
HTML
<template>
<div id='calendar' class="calendarmain" lwc:dom="manual"></div>
</template>