Kurounin / Pagination

This package allows you to paginate the subscriptions over meteor's collections. It can be used in a Blaze template or in ReactJS.
MIT License
56 stars 22 forks source link

Question: what is the best way to pass a "limit" parameter from the client to the server? #101

Closed carlosalvidrez closed 3 years ago

carlosalvidrez commented 3 years ago

I'd just like to control the total maximum number of records the server should fetch for the client. Wondering if a "limit" clause would work, or if I should think of this as a product of the number of items per page and the page number in turn.

Thanks!

Kurounin commented 3 years ago

You can set the limit either on init:

Template.myList.onCreated(function () {
    this.pagination = new Meteor.Pagination(MyCollection, {
        perPage: 20
    });
});

or by calling after init

this.pagination.perPage(20);

The default number of records returned is 10.

The documents returned is calculated like this:

carlosalvidrez commented 3 years ago

Thanks! Can I buy you a cup of coffee? Let me know if you have any sort of donation/fund-me page. I've been using your library and are very grateful that you not only shared it, but you still respond to issues/questions. Cheers!

Kurounin commented 3 years ago

There's no need to donate, but I appreciate the thought. I'm happy with contributing to the open source scene that I'm relying on so often myself.