Unable subscribe
Opened this issue · 0 comments
hello, please help me fix this issue with subscription not working. I used your exact code and only changed the collection name, but mongol show no subscription. Thanks .
`Template.RenderCalendar.helpers({
calId: 'clndr',
options: function () {
return {
events: function () {
var fc = $(this.calId);
// var fc = $('.fc');
return function (start, end, tz, callback) {
//subscribe only to specified date range
Meteor.subscribe('appointments', start.toDate(), end.toDate(), function () {
//trigger event rendering when collection is downloaded
fc.fullCalendar('refetchEvents');
});
//find all, because we've already subscribed to a specific range
var events = Appointments.find().map(function (it) {
return {
title: it.date.toISOString(),
start: it.date
};
});
callback(events);
};
}
};
}
});
Template.RenderCalendar.rendered = function () {
var calendar = $(this.calId);
//trigger event re-rendering when the collection is changed in any way
this.autorun(function () {
//2) find all, because we've already subscribed to a specific range
Appointments.find();
calendar.fullCalendar('refetchEvents');
});
};`
how ever if i use something like below, the subsription works, but i am unable to get the fullcalendar instance to be able to properly subscribe to a range using fc's start, end properties.
`events: function () {
var fc = $(this.calId);
// var fc = $('.fc');
return function (start, end, tz, callback) {
//subscribe only to specified date range
Meteor.subscribe('appointments', start.toDate(), end.toDate(), function () {
//trigger event rendering when collection is downloaded
fc.fullCalendar('refetchEvents');
});
//find all, because we've already subscribed to a specific range
var events = Appointments.find().map(function (it) {
return {
title: it.date.toISOString(),
start: it.date
};
});
callback(events);
};
}`