简体   繁体   English

如何限制按表格列出的返回字段

[英]How can I limit returned fields in aldeed tabular

I have a Products collection that has attributes including invoicePrice. 我有一个产品集合,其属性包括invoicePrice。 Is there a way I can set up my aldeed tabular datatable so it does not return invoicePrice? 有没有一种方法可以设置我的表格数据表,使其不返回invoicePrice? Looking through the aldeed tabular documentation, I was only able to find how to select which fields to return - something like: 通过查阅表格文件,我只能找到如何选择要返回的字段-类似:

selector: function ()
{
 return {author: "Agatha Christine"};
};

What I need is something to choose what NOT to return - something along the lines of: 我需要的是选择不返回的内容-类似以下内容:

selector: function ()
{
   {invoicePrice: 0};
};

Initially, I tried to limit the return fields by using my publish/subscription functions. 最初,我尝试使用发布/订阅功能来限制返回字段。 I realized that aldeed tabular actually bypasses my publish/subscription functions when I commented out my publish function for Products. 当我注释掉产品的发布功能时,我意识到aldeed表格实际上会绕过我的发布/订阅功能。

Does anyone have any idea on how I can select which fields NOT to return? 有人对我如何选择不返回的字段有任何想法吗?

Thanks! 谢谢!

if I'm not mistaken you can set that up on your "Meteor.publish" block! 如果我没记错的话,可以在“ Meteor.publish”块中进行设置!

Example: 例:

Meteor.publish('productsWithFewerFields', function(){
    return Products.find({}, {fields: {
        invoicePrice: false
    }});
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM