Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FullCalendar v4 navigation button click handler

How do I attach a handler to the navigation buttons in FullCalendar v4? There is nothing specified in the official documentation.

enter image description here

like image 660
Dany Dhondt Avatar asked Sep 02 '25 11:09

Dany Dhondt


1 Answers

The only build-in method is the events: fn () callback. From the docs

FullCalendar will call this function whenever it needs new event data. This is triggered when the user clicks prev/next or switches views.

document.addEventListener('DOMContentLoaded', function() {
    var calendarEl = document.getElementById('calendar');

    var calendar = new FullCalendar.Calendar(calendarEl, {
        plugins: [ 'dayGrid' ],
        defaultView: 'dayGridMonth',
        events: function (info) {
            console.log(info);
        }
    });

    calendar.render();
});
like image 198
Red Avatar answered Sep 05 '25 19:09

Red