fullCalendar获取某一天的日程(event)

4 篇文章 0 订阅

最近又是忙死的节奏。。。好久不做笔记,哎。最近的项目用到了fullCalendar这个插件,看了官方文档,确实是个很棒的插件,可以做到很多日历的事情。
官方API:
clientEvents

Retrieves events that FullCalendar has in memory.

.fullCalendar( ‘clientEvents’ [, idOrFilter ] ) -> Array
This method will return an array of Event Objects that FullCalendar has stored in client-side memory.

If idOrFilter is omitted, all events will be returned.

If idOrFilter is an ID, all events with the same ID will be returned.

idOrFilter may also be a filter function that accepts one Event Object argument and returns true if it should be included in the result set.

获取某天的event:

dayClick: function(date, jsEvent, view) {
        var events = $('#calendar').fullCalendar('clientEvents', function(event) {
            var eventStart = event.start;
            var eventEnd = event.end ? event.end : null;
            var theDate = date;
            // Make sure the event starts on or before date and ends afterward
            // Events that have no end date specified (null) end that day, so check if start = date
            return (eventStart <= theDate && (eventEnd >= theDate) && !(eventStart < theDate && (eventEnd == theDate))) || (eventStart == theDate && (eventEnd === null));
        });
        console.log(events); // do whatever with the console.log(events[0]._allDay); 
    }

这里只是dayclick的一个例子,可以在任何接口里使用,只要有date参数!

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值