alethes / meteor-pages

Meteor pagination
MIT License
403 stars 84 forks source link

Filtering issue #192

Closed ghost closed 8 years ago

ghost commented 8 years ago

I want to dinamically filter my collection. First I use this code to create the pagination collection

Purses = new Mongo.Collection('purses'); this.Pages = new Meteor.Pagination(Purses, { itemTemplate: "productItem", perPage: 9, sort: {price: 1}, availableSettings: { filters:true, perPage: true, sort: true }
})

I put this in the templates as explained in the documentation:

and it works correctly. The problem comes now, when I want to dinamically filter. I tried this: (productItem is the item template)

Template.productItem.events({ 'click .gucci': function(event){ event.preventDefault(); Pages.set({ filters: {perPage: 2, sort: { price: 1} }}); } });

with this code I would like to filter my collection, but what happens is that all the items disappear and nothing is displayed. I had the impression that sometimes, for a moment, 2 object are shown (as expected) but they immediately disappear.

What's wrong? Any other suggestions or code example for filtering with this package?