Reputation: 237
I am trying to implement pagination using Meteor Pages in a template displaying all online users in my app.
Pages = new Meteor.Pagination(Meteor.users, {
itemTemplate: "Item",
auth: function(skip, sub){
var _filters = {'status.online' : true};
var _options = {sort: {name: 1}};
return [_filters, _options];
},
availableSettings: {
perPage: true,
sort: true,
filters:true
},
perPage : 20,
route: "/onlineusers/",
router: "iron-router",
routerTemplate: "onlineusers",
templateName: "onlineusers",
});
I am able to display all online users in my template using the above code block. Now, I want to filter the results further with parameters like age gender and country as provided from the client. How can I use filters to further modify the results at the client. Thanks in advance...
Upvotes: 1
Views: 149
Reputation: 86
Referring to the documentation, you can pass a MongoDB find query object to the use the 'filters' property in your settings object.
For example:
Pages = new Meteor.Pagination(Meteor.users, {
...,
filters: {
<name>: {
$eq: <value>
}
},
...
});
Upvotes: 1