Fullcalendar.js 通过点击获取当天的事件
是否可以获取我在月 View 中点击的当天的所有事件,并使用 Fullcalendar.js
在任何 div
元素中打印它们?
这是我的 JSFiddle:
最佳答案
您始终可以遍历所有事件并找出选定日期发生的事件。这是我执行此操作的函数:
function getEvents(date){
all_events.forEach(function(entry) {
if (entry['start'] == date.format()){
alert(entry['title']);}
else if (entry['start'] <= date.format() && entry['end'] >= date.format()){
alert(entry['title']);}
});
}
你可以看到我的DEMO 。
如果您点击日期 2014-10-06,警报中将显示 2 个事件。单击日期 2014-10-07 将仅提醒一个事件。
关于javascript - Fullcalendar.js 通过点击获取当天的事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26151121/