Meteor pagination


#1

Hey everyone! i am struggling with adding in pagination for my forums. Could you help me out? I am using this package: https://atmospherejs.com/percolate/paginated-subscription

Here is the code I am using:
``
if (Meteor.isClient) {

Deps.autorun(function() {
var handle = Meteor.subscribeWithPagination('posts',10);

});

Template.postsList.helpers({
    'posts': function(){
        return Posts.find({});
    }
});

Template.postsList.events({
    'click .btn': function(){
        handle.loadNextPage();
    }
})

}

if (Meteor.isServer) {
Meteor.startup(function () {
Meteor.publish(“posts”, function(limit){
return Posts.find({}, {limit: limit});
});

});

}


#2

Can you outline what the exact issue is you’re having?


#3

Sorry about that. It was late! Basically, I was expecting on my forums page, to only see 10 posts. but it is returning all of them. The “Load More” button also does nothing (it seems like).


#4

This is a pretty good overview of pagination in Meteor, I think: https://www.discovermeteor.com/blog/pagination-problems-meteor/