I configured a calendar that has AgendaDay and AgendaWeek on the same page. anything working fine on both view, but by some small changes on Resources.
For Day I loaded the list of teacher and show them as the column, but if I want to work on week view, I should remove the Resource codes. That after this change the agenda week will work as well.
As you see by this method just one of them will be working at the same time.
I use FullCalendar v3 Resource callback function
resources: function(callback){
jQuery('input[name="start"]').val($('#calendar').fullCalendar('getView').start.format());
jQuery('input[name="end"]').val($('#calendar').fullCalendar('getView').end.format());
$.ajax({
url: resourcesCallback,
type: 'GET',
dataType: "json",
data: jQuery('.calendar_filter_form').serialize(),
error: function() {
// alert('Oops! Try again.');
},
success: function(response){
callback(response);
}
});
}
So how I can set it to load resource just when it is AgendaDay and ignore it on AgendaWeek?
This is a demo that I try to handle more dynamic. https://codepen.io/nasser-ali-karimi/pen/QWLvypO?editors=0010
Update the question
As I checked there is no issue with resource call back. Actually, the issue is with calendar configurations.
1- groupByResource: true
2- groupByDateAndResource: true
When I use both as true, the agenda Day shows data grouped in the correct format, not on AgendaWeek. The code pen demo https://codepen.io/nasser-ali-karimi/pen/ExYXWer?editors=0010
there you can change groupByDateAndResource
to false by this switching the grouping will change and become based on instructor and days( in demo looks better.)
Main Issue: I need to change the configuration for Agenda Day and Agenda Week specifically, In my case, I need to use groupByDateAndResource: True and groupByResource: true for Agenda Day but these two items should be false for Agenda Week on the same page.
As I checked there is no issue with resource call back. Actually, the issue is with calendar configurations.
1- groupByResource: true
2- groupByDateAndResource: true
So I need to use groupByDateAndResource: True
and groupByResource: true
for Agenda Day but these two items should be false
for Agenda Week on the same page.
So I do that with views option https://codepen.io/nasser-ali-karimi/pen/mdbwmdO?editors=0010
$("#calendar").fullCalendar({
defaultView: "agendaDay",
views: {
week: {
groupByResource: false,
groupByDateAndResource: false,
},
day: {
groupByResource: true,
groupByDateAndResource: true,
},
},
...
});