javascript - Pagination with alethes:pages using a subscription -
folks. i'm using alethes:pages
pagination in meteor app, , i'm needing use existing subscription control data it's displaying. seems way works paginates of records in collection, , not specific stuff want shown.
the code i've got far looks this, defining pagination:
browsepages = new meteor.pagination(mods, { perpage: 15, sort: { createdat: -1 }, templatename: "browsemodslist", itemtemplate: "browsemoditem", table: { fields: ["name", "category", "createdat"], header: ["name", "author", "category", "date added", "rating", "current version"], class: "table table-striped" }, divwrapper: false, auth: function(skip, sub) { var thecat = categories.findone({slug: router.current().params.slug}); return mods.find({category: thecat._id}); } });
i assuming limit paginated data cursor i'm returning via auth
, it's hanging there spinner now.
i'm pretty confused, shed light on awesome. i'm looking enforce same limitation (somehow) onto pagination, don't know how it.
here's more relevant code:
route:
// browse router.route('/browse/:slug', function() { this.render('browsemodslist'); }, { name: 'browse', waiton: function() { return [ subs.subscribe('catmods', this.params.slug) ] } });
publication
meteor.publish('catmods', function(tag) { var category = categories.findone({slug: tag}); if (category) { var catid = category._id; return mods.find({category: catid}); } else { return this.ready(); } });
thanks ahead of time assistance, usual!
add fields key shown below.
browsepages = new meteor.pagination(mods, { perpage: 15, fields: {name: 1, category:1, createdat:1}, });
Comments
Post a Comment