Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable subscribe #33

Open
nosizejosh opened this issue Mar 20, 2016 · 0 comments
Open

Unable subscribe #33

nosizejosh opened this issue Mar 20, 2016 · 0 comments

Comments

@nosizejosh
Copy link

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);
          };
       }`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant