Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用alethes分页:使用订阅的页面_Javascript_Node.js_Meteor_Pagination - Fatal编程技术网

Javascript 使用alethes分页:使用订阅的页面

Javascript 使用alethes分页:使用订阅的页面,javascript,node.js,meteor,pagination,Javascript,Node.js,Meteor,Pagination,伙计们。我在Meteor应用程序中使用alethes:pages进行分页,我需要使用现有订阅来控制它显示的数据。它的工作方式似乎是只对集合中的所有记录进行分页,而不是我想要显示的特定内容 到目前为止,我得到的代码如下所示,定义分页: BrowsePages = new Meteor.Pagination(Mods, { perPage: 15, sort: { createdAt: -1 }, templateName: "browseModsLi

伙计们。我在Meteor应用程序中使用
alethes:pages
进行分页,我需要使用现有订阅来控制它显示的数据。它的工作方式似乎是只对集合中的所有记录进行分页,而不是我想要显示的特定内容

到目前为止,我得到的代码如下所示,定义分页:

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});
    }
});
我假设它会将分页数据限制在我通过
auth
返回的光标上,但现在它只是挂在那里,有一个微调器

我很困惑,任何人如果能对这件事有所了解都会很棒。我希望在分页上强制执行相同的限制(不知何故),我只是不知道怎么做

以下是更相关的代码:

路线:

// Browse
Router.route('/browse/:slug', function() {
    this.render('browseModsList');
}, {
    name: 'browse',
    waitOn: function() {
        return [
            Subs.subscribe('catMods', this.params.slug)
        ]
    }
});
出版

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();
    }
});

如往常一样,提前感谢您的帮助

添加字段键,如下所示

BrowsePages = new Meteor.Pagination(Mods, {

    perPage: 15,
    fields: {name: 1, category:1, createdAt:1},

});

添加字段键,如下所示

BrowsePages = new Meteor.Pagination(Mods, {

    perPage: 15,
    fields: {name: 1, category:1, createdAt:1},

});