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

How make aggregation with pagination? #61

Closed pipoblak closed 6 years ago

pipoblak commented 6 years ago

Hi, i'm enjoying using this package in my project, but i'm faced with a problem:

I have a Collection named Tickets: tickets:{ _id, customer_id, content }

And a Collection named Customers: customers:{ _id, name, email }

I made a search and found AGGREGATION solution, but is apparently incompatible with this package. How can i do the relation?

Thank you for your attention.

Kurounin commented 6 years ago

Hi,

What exactly do you want to display? You can make multiple paginations, one for tickets, and others for the customers of those tickets.

pipoblak commented 6 years ago

I have make this, but i'm having a timing issue... any tips to knows when all paginations are ready?

pipoblak commented 6 years ago

Can i observe the pagination.ready() change? or add a callback ?

Kurounin commented 6 years ago

Yes, pagination.ready() is reactive and will let you know once the subscription was updated and documents were received.

pipoblak commented 6 years ago

Thx for all of your help, i'm using what you tell me, and now a new question has appeared, When i use pagination.filters(), what can i watch for a ready state ?

Kurounin commented 6 years ago

When changing the current pagination filters using pagination.filters(newFilters) the subscription might already be ready, so checking pagination.ready() immediately after won't help you. To link the changing of filters to the pagination being ready for the new filters, you would have to implement custom logic to keep track of the filters being changed and the pagination being set to ready after this. The easiest solution would be to display a loading anytime the pagination is not ready.