切换fullcalendar视图时重新获取事件 [英] Refetch events when switching fullcalendar views

查看:4089
本文介绍了切换fullcalendar视图时重新获取事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在日历中使用了3个视图:month,agendaWeek和agendaDay。添加事件后,我调用refetchEvents来显示新事件。如果我从agendaweek或agendaDay添加活动,那么重新获取活动当然会抓取一周或一天的活动。如果我然后切换到月视图,我只有一周或一天的事件。

I'm using 3 views in my calendar: month, agendaWeek, and agendaDay. After I add an event, I call refetchEvents to display the new event. If I add an event from agendaWeek or agendaDay, the refetch will of course grab the events for the week or day. If I then switch to the month view, I only have the events for the week or the day.

我已经尝试在viewDisplay上添加refetchEvents。问题在于它在初始加载时运行,导致所有事件的重复。有没有办法阻止在日历加载过程中调用refetchEvents?

I've tried adding a refetchEvents on viewDisplay. The problem with this is that it runs on the initial load which causes the duplication of all the events. Is there a way I can stop refetchEvents from being called during the calendar load?

有没有其他方法可以在切换视图时强制执行重新提取?

Is there any other way to force the refetch when switching views?

推荐答案

对于fullcalendar库自身来说,这听起来像是个好主意 - 库可以为viewChanged甚至viewChanging事件提供回调函数。
这样的东西真的很缺失,因为如果您需要创建AJAX深层链接,您还需要知道视图何时发生变化。

Sounds like a good idea for an enhancment to fullcalendar library itself - the library could provide callback function for "viewChanged" or even "viewChanging" event. Such thing is really missing, because, if you need to create "AJAX deep linking", you also need to know when the view has changed.

更新:如果您更改lazyFetching选项,会发生什么情况 http://arshaw.com/fullcalendar/docs / event_data / lazyFetching / 添加事件后的日历?

Update: what happens if you change the "lazyFetching" option http://arshaw.com/fullcalendar/docs/event_data/lazyFetching/ of your calendar after you add the event?

这篇关于切换fullcalendar视图时重新获取事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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