Fullcalendar.js通过点击获取当天的事件 [英] Fullcalendar.js get events of the day on click

查看:1025
本文介绍了Fullcalendar.js通过点击获取当天的事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Fullcalendar.js通过点击获取当天的事件



是否有可能在monthview中点击当天的所有事件并将其打印在任何 div 元素与 Fullcalendar.js



这是我的JSFiddle :



http://jsfiddle.net/您可以随时迭代所有事件并找出选定的事件天。这是我的功能:

$ p $ 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']);}
});




$ b

你可以看到我的 DEMO



如果您点击日期2014-10-06,则会有2个事件显示在警报中。点击日期2014-10-07只会提醒一个事件。


Fullcalendar.js get events of the day on click

Is it possible to get all events of the day I click on in the monthview and print them in any div element with Fullcalendar.js?

Here's my JSFiddle:

http://jsfiddle.net/alexchizhov/syf9ycbc/4/

解决方案

You can always iterate over all events and find out which event is on selected day. Here is my function to do that:

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']);}
         });

    }

You can see my DEMO.

If you click on date 2014-10-06 there will be 2 events that will shows up in alert. Click on date 2014-10-07 will alert only one event.

这篇关于Fullcalendar.js通过点击获取当天的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆