在Meteor表格中调用行

在Meteor表格中调用行,meteor,tabular,Meteor,Tabular,我用表格为流星建立了这个表格 在渲染函数中有val、type和doc。Doc是数据库中整个条目的信息。但是,如果我没有在列中指定它,它不会返回。例如,我删除了 TabularTables.Transactions = new Tabular.Table name: "Transactions" collection: Transactions responsive: true columns: [ { data: "transactionOperation"

我用表格为流星建立了这个表格

在渲染函数中有val、type和doc。Doc是数据库中整个条目的信息。但是,如果我没有在列中指定它,它不会返回。例如,我删除了

TabularTables.Transactions = new Tabular.Table
  name: "Transactions"
  collection: Transactions
  responsive: true
  columns: [
    {
      data: "transactionOperation"
      title: "Operation"
    }
    {
      data: "sum"
      title: "Sum"
      render: (val, type, doc)->
        if doc.transactionOperation == "Credit"
         return "- " + val
        else
         val
    }
  ]
部分中,如果doc.transactionOperation==“Credit”,则呈现
中的逻辑永远不会为true,因为未设置doc.transactionOperation
Console.log(doc)
显示对象只有Sum属性


有没有办法让它返回整行而不是只返回指定的列?

查看extraFields属性。这对你来说应该有用

{
      data: "transactionOperation"
      title: "Operation"
    }
通过将字段添加到extraFields属性,可以发布这些字段,并且可以从render函数中的doc变量中检索这些字段

这是这方面的官方文件。

它仍然没有返回。
 TabularTables.Transactions = new Tabular.Table({
  name: "Transactions"
  collection: Transactions
  extraFields: ['transactionOperation']
  /* columns go here
  */
 });