karancan karancan - 1 month ago 13
jQuery Question

FullCalendar switch between weekends and no weekends

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 the timeslot interval from say 30 minutes to 60 minutes.

In other words, what I am trying to do is:

//Clicking the button that shows Saturday and Sunday too
$('#weekend-yes').click(function(){
$('#weekend-yes').hide();
$('#weekend-no').fadeIn();
//HYPOTHETICALLY DO THIS
$('#calendar').fullCalendar('option', 'weekends', true/false);
});


If something like that is not possible, what would be the best workaround? I guess I could have a second calendar which is a replica of the first, but that would be too much replication.

Appreciate any help I can get..

Answer

Per the author of this plugin, all the FullCalendar options don't have setters (unfortunately weekends is one of them). So I think you have a couple of options

  1. reinit (destroy and init) the calendar with weekends set to true/false
  2. edit the source for the plugin to add a setter for this option. I have seen issues logged around this, but I don't think this plugin is actively developed anymore.

All the best!