Fullcalendar显示每天的事件数 [英] Fullcalendar display the count of events per day

查看:369
本文介绍了Fullcalendar显示每天的事件数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是FullCalendar,我想在每天的所有视图中显示每天的事件数。

I using the FullCalendar and i would like display the count of events per day in all views for each days.

示例:

<div class="fc-day-number">1</div>

更改为:

<div class="fc-day-count">X</div>
<div class="fc-day-number">1</div>

请以屏幕截图为例:
链接

提前致谢

推荐答案

我希望这有助于某些人,但不知道这是否是您正在寻找的确切答案。

I hope this helps someone but don't know if it's the exact answer you're looking for.

要获取一天发生的事件数量,您可以使用以下代码:

To get the number of events that occur on a day you can use the following code:

$('#calendar').fullCalendar( 'clientEvents', function(eventObj){
    if (eventObj.start.isSame('2014-11-21')) {
        return true;
    } else {
        return false;
    }
}).length;

根据fullcalendar文档,您可以搜索具有过滤功能的事件 clientEvents

As per fullcalendar documentation you can search for events with a filter function clientEvents.

函数中的if语句使用 moment.js ,包含在fullcalendar 2.0中

The if statement in the function compares dates using moment.js which is included in fullcalendar 2.0

这篇关于Fullcalendar显示每天的事件数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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