I was wondering if there was a way in Arshaw\'s FullCalendar to: 1- Change the calendar from showing weekends to not show weekends and vice versa. 2- To dynamically change t
Update for 2017: FullCalendar added a weekend setter in 2.9.0 (7-10-2016), so no calendar destroy or custom view manipulation is necessary anymore.
Here's how I implemented a weekend toggle in my production app using FullCalendar 3.1.0:
var calendarOptions = {
...
customButtons: {
toggleWeekends: {
text: 'Show Weekends',
click: function() {
toggleWeekends();
},
},
},
...
header: {
left: 'today toggleWeekends',
...
},
weekends: false,
}
function toggleWeekends() {
var weekends = $('#calendar').fullCalendar('option', 'weekends');
var text = 'Show Weekends';
if (weekends == false) {
text = 'Hide Weekends';
}
$('#calendar').fullCalendar('option', {
customButtons: {
toggleWeekends: {
text: text,
click: function() {
toggleWeekends();
},
},
},
weekends: !weekends,
});
}