Customize calendar with javascript

Hi all, I’m really hoping someone can help.

I’m creating an app with 2 calendars side by side in day view. I want to keep the calendars synchronised so that when clicking the ‘previous’, ‘next’ or ‘today’ buttons on one calendar executes the action on both calendars.

I’m sure this can be achieved in javascript, but I’ll be damned if I can make it work.

Can anybody help?

With thanks in advance, Neil.

Hello Neil,

Check out the page for the next and prev only
https://roberts.knack.com/farmers#calendar-test/

change id’s as per your view
var clicked = 0;
$(“#view_97 .fc-button-prev”).live(“click”, function () {
if (clicked == 0) {
clicked = 1;
$(“#view_39 .fc-button-prev”).trigger(“click”);

}
else
	clicked = 0

});

$(“#view_39 .fc-button-prev”).live(“click”, function () {
if (clicked == 0) {
clicked = 1;
$(“#view_97 .fc-button-prev”).trigger(“click”);

}
else
	clicked = 0

});

$(“#view_97 .fc-button-next”).live(“click”, function () {
if (clicked == 0) {
clicked = 1;
$(“#view_39 .fc-button-next”).trigger(“click”);

}
else
	clicked = 0

});

$(“#view_39 .fc-button-next”).live(“click”, function () {
if (clicked == 0) {
clicked = 1;
$(“#view_97 .fc-button-next”).trigger(“click”);

}
else
	clicked = 0

});

Regards,
Sunny Singla
info@sandt-consultancyservices.com

2 Likes

That’s just the job!

Thank you so much Sunny, you’re a hero :+1: