在流星表格中使用集合帮助程序



我正在使用 Meteor 显示表数据 aldeed:tabular

表格初始化代码很简单:

this.TabularTables.Customers = new Tabular.Table({
    name: "Clients",
    collection: this.Customers,
    columns: [
        {data: "lastName", title: "Name"},
        {data: "myMessage()", title: "Message"}
    ],
});
第一个字段,

姓氏可以完美运行,但是添加第二个字段myMessage()会导致问题

我安装了dburles:collection-helpers扩展并在通用代码部分添加了helper:

this.Customers = new Mongo.Collection("customers");
this.Customers.helpers({
    myMessage: function () {
        return "Hi!";
    }
});

但仍然在客户端出现错误:

Exception from Tracker recompute function:
debug.js:41 TypeError: a[i[j]] is not a function
at c (jquery.dataTables.min.js:16)
at jquery.dataTables.min.js:17

我的帮助程序函数可能存在什么问题,我应该在哪里声明它?

我或多或少已经完成了你所做的事情,而且效果很好。

Countries = new Mongo.Collection('countries');
TabularTables = {};
Meteor.isClient && Template.registerHelper('TabularTables', TabularTables);
TabularTables.Countries = new Tabular.Table({
    name: "CountriesList",
    collection: Countries,
    columns: [
        {data: 'italian_name', title: 'Italian name'},
        {data: 'catalogueName',title: 'Catalogue name'},
        {data: "myFunction()", title: 'Wot'}
    ]
});
Countries.helpers({
    myFunction: function () {
        return "Hi!";
    }
});

我能看到的唯一真正的区别是这一行:

Meteor.isClient && Template.registerHelper('TabularTables', TabularTables);

最后我发现了问题:TabulatTables 使用集合转换器 dburles:collection-helpers 来调用必要的函数,但它与定义他自己的助手的 perak:join 相冲突

最新更新