function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sfuser12sfuser12 

Calendar in lightning on custom button

Hello,

I am using this code as I want same functionality- https://blogs.absyz.com/2018/07/12/custom-calendar-lightning-component/.

I did everything as mentioned. But I am getting error.
User-added image

I have copied code same as given in document. I didnt find any problem in handleclick function. ot getting what to do. Has anybody tried this before?

Thanks,
sfuser12
Best Answer chosen by sfuser12
Khan AnasKhan Anas (Salesforce Developers) 
Hi,

Greetings to you!

The problem is in the fullCalendar library name. The name of the zip file you downloaded is fullcalendar-3.9.0.zip
But in the lightning component, you are using fullcalendar390 instead of fullcalendar-3.9.0

So, instead of:

<ltng:require styles="{!$Resource.Calender     + '/fullcalendar390/fullcalendar.css'}"
                  scripts="{!join(',',
                           $Resource.Calender  + '/fullcalendar390/lib/jquery.min.js',
                           $Resource.Calender  + '/fullcalendar390/lib/moment.min.js',
                           $Resource.Calender  + '/fullcalendar390/fullcalendar.js'
                           )}"
                  afterScriptsLoaded="{!c.afterScriptsLoaded}" />

Use this:
<ltng:require styles="{!$Resource.Calender     + '/fullcalendar-3.9.0/fullcalendar.css'}"
                  scripts="{!join(',',
                           $Resource.Calender  + '/fullcalendar-3.9.0/lib/jquery.min.js',
                           $Resource.Calender  + '/fullcalendar-3.9.0/lib/moment.min.js',
                           $Resource.Calender  + '/fullcalendar-3.9.0/fullcalendar.js'
                           )}"
                  afterScriptsLoaded="{!c.afterScriptsLoaded}" />


I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks and Regards,
Khan Anas

All Answers

Khan AnasKhan Anas (Salesforce Developers) 
Hi,

Greetings to you!

The problem is in the fullCalendar library name. The name of the zip file you downloaded is fullcalendar-3.9.0.zip
But in the lightning component, you are using fullcalendar390 instead of fullcalendar-3.9.0

So, instead of:

<ltng:require styles="{!$Resource.Calender     + '/fullcalendar390/fullcalendar.css'}"
                  scripts="{!join(',',
                           $Resource.Calender  + '/fullcalendar390/lib/jquery.min.js',
                           $Resource.Calender  + '/fullcalendar390/lib/moment.min.js',
                           $Resource.Calender  + '/fullcalendar390/fullcalendar.js'
                           )}"
                  afterScriptsLoaded="{!c.afterScriptsLoaded}" />

Use this:
<ltng:require styles="{!$Resource.Calender     + '/fullcalendar-3.9.0/fullcalendar.css'}"
                  scripts="{!join(',',
                           $Resource.Calender  + '/fullcalendar-3.9.0/lib/jquery.min.js',
                           $Resource.Calender  + '/fullcalendar-3.9.0/lib/moment.min.js',
                           $Resource.Calender  + '/fullcalendar-3.9.0/fullcalendar.js'
                           )}"
                  afterScriptsLoaded="{!c.afterScriptsLoaded}" />


I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks and Regards,
Khan Anas
This was selected as the best answer
sfuser12sfuser12
Thanks Khan Anas!
Its really working well with your code. Than you very much for your kind help.
sh hasansh hasan
I was trying to do the same, but I dont see any lib folder after downloding the fullcalender library.  Which fiels I should use in this code snipet?
<ltng:require styles="{!$Resource.Calender     + '/fullcalendar-3.9.0/fullcalendar.css'}"                  
scripts="{!join(',',                            
$Resource.Calender  + '/fullcalendar-3.9.0/lib/jquery.min.js',                            
$Resource.Calender  + '/fullcalendar-3.9.0/lib/moment.min.js',                            
$Resource.Calender  + '/fullcalendar-3.9.0/fullcalendar.js'                            
)}"

User-added image

​​​​​​​Thanks for your help.