2016-06-01 3 views
1

私は、アプリケーション内のすべてのオンラインユーザーを表示するテンプレートでMeteor Pagesを使用してページネーションを実装しようとしています。Meteor Pagesを使用したページネーション

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", });

私は上記のコードブロックを使用して、私のテンプレート内のすべてのオンラインユーザーを表示することができています。現在、クライアントから提供された年齢や性別などのパラメータを使用して結果をさらに絞り込んでいます。フィルタを使用してクライアントで結果をさらに変更するにはどうすればよいですか。事前にありがとうございます...

答えて

1

documentationを参照すると、MongoDB検索クエリオブジェクトを設定オブジェクトの 'filters'プロパティに渡すことができます。例えば

Pages = new Meteor.Pagination(Meteor.users, { 
..., 
filters: { 
    <name>: { 
    $eq: <value> 
    } 
}, 
... 
}); 
関連する問題