流星使用aldeed的数据表:表格

问题描述:

我正在使用从webservice的数据表加载数据。我有多个记录,现在我想添加按钮,它将显示4行或所有行。我知道选项iDisplayLength,但我不知道如何访问该变量。流星使用aldeed的数据表:表格

这里是我的数据表初始化的样子:

Places = new Mongo.Collection("places"); 
TabularTables = {}; 
Meteor.isClient && Template.registerHelper('TabularTables', TabularTables); 

TabularTables.Places = new Tabular.Table({ 
    name: "LocationsList", 
    collection: Places, 
    columns: [ 
     {data: "naziv", title: "Name"}, 
     // {data: "status", title: "Status"}, 
     // {data: "bencinska", title: "Station"}, 
     {data: "razdalja", title: "Distance (km)"}, 
     {data: "", title: "", 
      tmpl: Meteor.isClient && Template.btn_favorite, 
      tmplContext: function(rowData) { 
       return { 
        item: rowData, 
        column: "" 
       }; 
      } 
     } 
    ], 
    // aLengthMenu: [[3, -1], [3, "Vsi"]], 
    iDisplayLength: -1, 
    order: [[ 1, "asc" ]], 
    limit: 30, 
    responsive: true, 
    autoWidth: false 
}); 

这里是我的模板:

<template name="table"> 
    {{> tabular table=TabularTables.Places class="table centered highlight compact" id="data_table"}} 
</template> 

如果有人知道的良好格局加载表(现在它显示无可用数据,当它没有加载时),请给我一个建议。数据何时加载以及何时尚未加载?

编辑:

我已删除的过滤器和展示物品的助手从数据表,因为我想用更优雅的设计来解决这个问题。

有几件事情,首先,如果在提问有关任何库的问题时提及您使用的库的版本,可能是最好的。我假设你正在使用DataTables 1.10.x.但请注意,此版本有API更改,如果您使用v1.9或更早版本,则此信息可能不适用。

其次,选项仅用于初始化。所以你不能用iDisplayLength来解决这个问题。

Options

数据表的选择范围大,可以使用自定义,这将呈现其界面的方式 ,和可用的功能,给 终端用户。这是通过其配置选项完成的,其配置选项为 ,设置在初始化时间

这就是说,我不能写代码来尝试这个,但我认为你将需要使用page.len()method

请注意,您可以传递-1来显示所有行,否则传递的参数是您要显示的行数。