早上好!
我在完整日历中设置了一个列表视图,并且注意到它不会显示年底之前的事件。现在是12月中旬,这对我来说是个问题。我们有几个事件应显示在此列表中。当我将视图更改为月时,我必须单击下个月按钮以获取下一年的事件,但是至少我确实成功地看到了相关事件。
当我临近今年年底时,是否有办法让列表视图日历翻转并包含明年的条目?
以下是我对日历显示有影响的摘要:
{url:'https://calendar.mydomain.com/services/id/38djsuw3hr-au8reh39dq/organization/1/department/13/',event_properties:{color:'#6a9b49'}},
]
function data_req (url, callback) {
req = new XMLHttpRequest()
req.addEventListener('load', callback)
req.open('GET', url)
req.send()
}
function add_recur_events() {
if (sources_to_load_cnt < 1) {
$('#calendar').fullCalendar('addEventSource', expand_recur_events)
} else {
setTimeout(add_recur_events, 30)
}
}
function load_ics(ics){
data_req(ics.url, function(){
$('#calendar').fullCalendar('addEventSource', fc_events(this.response, ics.event_properties))
sources_to_load_cnt -= 1
})
}
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: '',
center: '',
right: '' //view options on top-right (supported by v2.9.1 currently)
},
viewDisplay: function(view) {
parent.setIframeHeight(iframeId) ;
},
eventClick: function(event) {
// opens events in a new window or tab
window.open(event.url,);
return false;
},
// eventDataTransform: function(rawEventData){
// return {title: rawEventData.Title
// };
// },
defaultView: $(window).width() < 765 ? 'listYear':'listYear', //carryover code from full sized calendar
nowIndicator: false, //show a marker for current time
eventLimit: 4, // allow "more" link when too many events
fixedWeekCount: false, // have blank rows on a 6 or 7 row month
listDayFormat: 'MMMM Do',
listDayAltFormat: false,
allDayDefault: false,
noEventsMessage: "No Currently Scheduled Events"
})
sources_to_load_cnt = ics_sources.length
for (ics of ics_sources) {
load_ics(ics)
}
add_recur_events()
})
在列表视图中,我只看到我的“ NoEventsMessage”文本。如果我创建一个测试事件,则该事件会在年底之前显示在列表视图中。
关于跨日历结束的任何想法? 谢谢
[ Edit :我应该说顶部的链接是JSON提要,因此,我没有使用脚本中或外部文件中的事件预填充列表] >
答案 0 :(得分:1)
这是我解决的方式。
我为称为“列表”的特定默认视图创建了一个自定义视图条目,并将其期限设置为一年:
views: {
list: {
duration: { days:365 }
}
},
我从全尺寸日历中继承的动态版本中重置了默认视图(因为无论如何我都在列中使用此视图,因此不需要窗口宽度调用):
发件人:
defaultView: $(window).width() < 765 ? 'listYear':'listYear',
收件人:
defaultView: 'list',
完成这些操作后,我明年的1月条目开始显示在列表视图中。
这是我的显示调用的外观(如果有人要对其进行编辑以使其看起来更漂亮,更高效,我不在乎:)。
ics_sources = [
{url:'https://calendar.mydomain.com/services/id/38djsuw3hr-au8reh39dq/organization/1/department/13/',event_properties:{color:'#6a9b49'}},
]
function data_req (url, callback) {
req = new XMLHttpRequest()
req.addEventListener('load', callback)
req.open('GET', url)
req.send()
}
function add_recur_events() {
if (sources_to_load_cnt < 1) {
$('#calendar').fullCalendar('addEventSource', expand_recur_events)
} else {
setTimeout(add_recur_events, 30)
}
}
function load_ics(ics){
data_req(ics.url, function(){
$('#calendar').fullCalendar('addEventSource', fc_events(this.response, ics.event_properties))
sources_to_load_cnt -= 1
})
}
$(document).ready(function() {
$('#calendar').fullCalendar({
header: false,
viewDisplay: function(view) {
parent.setIframeHeight(iframeId) ;
},
eventClick: function(event) {
// opens events in a new window or tab
window.open(event.url,);
return false;
},
defaultView: 'list',
nowIndicator: false, //show a marker for current time
eventLimit: 4, // allow "more" link when too many events
fixedWeekCount: false, // have blank rows on a 6 or 7 row month
listDayFormat: 'MMMM Do',
listDayAltFormat: false,
noEventsMessage: "No Currently Scheduled Events",
views: {
list: {
duration: { days: 365 },
}
}
})
sources_to_load_cnt = ics_sources.length
for (ics of ics_sources) {
load_ics(ics)
}
add_recur_events()
})
谢谢。
[edit:从答案中删除了多余的反引号。]