我配置了一个在同一页面上有 AgendaDay 和 AgendaWeek 的日历。 任何东西在两个 View 上都可以正常工作,但需要对资源进行一些小的更改。
对于 Day,我加载了教师列表并将它们显示为列,但如果我想在周 View 中工作,我应该删除资源代码。在此更改之后,议程周也将正常工作。
正如您通过这种方法看到的那样,只有其中一个会同时工作。
我使用 FullCalendar v3 资源回调函数
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);
}
});
}
那么我如何才能将它设置为仅在 AgendaDay 时加载资源并在 AgendaWeek 时忽略它?
这是我尝试处理更多动态的演示。 https://codepen.io/nasser-ali-karimi/pen/QWLvypO?editors=0010
Update the question
正如我所检查的,资源回调没有问题。实际上,问题出在日历配置上。
1- groupByResource: true
2- groupByDateAndResource: true
当我将两者都设为 true 时,议程日显示以正确格式分组的数据,而不是在 AgendaWeek 上。 码笔演示https://codepen.io/nasser-ali-karimi/pen/ExYXWer?editors=0010
您可以通过此切换将 groupByDateAndResource
更改为 false,分组将更改并变为基于讲师和天数(在演示中看起来更好。)
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.
最佳答案
正如我所检查的,资源回调没有问题。实际上,问题出在日历配置上。
1- groupByResource: true
2- groupByDateAndResource: true
所以我需要为 Agenda Day 使用 groupByDateAndResource: True
和 groupByResource: true
但是这两项对于 Agenda Week 应该是 false
同一页。
所以我用 View 选项来做到这一点 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,
},
},
...
});
关于javascript - agendaWeek 和 agendaDay 上的 FullCalendar 冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57670120/