What's the general way of doing this? I have problems with fullcalendar reactive wrapper. Official version (rzymek) unfortunately doesn't work properly, so I decided to create my own wrapper. I used rendered and destroyed events for plugin instance initialization and destruction, but ... it's not working reactively (to be clear, it works exactly like rzymek version). What's wrong?
EDIT: My problem aren't only reactive events, I want full calendar fully reactive, that means, every change of inicialization arguments should rerender calendar to new state.
答案 0 :(得分:1)
Fullcalendar让反应性工作变得有点棘手。我最终使用的一个OK hack包括一个Collection.find()调用和一个自动运行中的refetchEvent,如下所示:
Template.foo.onRendered(function() {
this.autorun(function() {
YourCollection.find({});
$(".calendar").fullCalendar("refetchEvents");
});
});
因此,您对YourCollection
所做的任何更新都会触发refetchEvent,这将执行您的events
和eventRender
全日历回调,然后您可以在此处更新日历。
答案 1 :(得分:0)
问题是,当Blaze的参数发生变化时,Blaze不会重新渲染模板。这真的很奇怪。怎么解决这个?使用Template.currentData(),它是返回实际模板数据上下文的反应源。下一步是:在onRendered回调中,我们启动自动运行,它会监听模板数据上下文中的更改并根据更改重新呈现日历。
最后,我们有反应性的fullcalendar。