I'm making a calendar, using the "timeline" view of FullCalendar . What I want to do is change the "resources" in a dynamic way, since I already have a view of Students and the Projects view, each with its corresponding events.
I tried to do something like this:
var resources = 'students';
$('#calendar').fullCalendar({
resources: {
url: 'resource-load.php',
type: 'POST',
data: {
'data': resources
}
}
});
And views the changes from a select:
switch (selected) {
case 'general':
$('#calendar').fullCalendar( 'changeView', 'month');
break;
case 'students':
$('#calendar').fullCalendar( 'changeView', 'timelineDay');
$('#calendar').fullCalendar('option','resourceLabelText','Students');
resources = 'students';
$('#calendar').fullCalendar('refetchResources');
break;
case 'proyects':
$('#calendar').fullCalendar( 'changeView', 'timelineDay');
$('#calendar').fullCalendar('option','resourceLabelText','Proyects');
resources = 'proyects';
$('#calendar').fullCalendar('refetchResources');
break;
default: break;
}
What makes the students load at first, but when I change my view, nothing happens.
In the StackOverflow in English, I was told that I could get resources with a feature , and then reload the plugin, but the problem is that I do not understand how to do this, since I have not studied javascript so thoroughly. If someone could explain how to do this, it would be ideal.