SOLVED: I was using sorting in the filtering field (I don’t know how to delete this post)
Hi everyone!
I’m using alethes:pages and 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:
{{> pages}}
{{> pagesNav}}
and it works correctly!
My 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?
Thank you very much!