2016-01-13 37 views
0

我從工作的基本用戶管理項目: https://github.com/themeteorchef/building-a-user-admin流星創建客戶名單表使用表格

我想改變用戶名單表到DataTable使用aldeed:表格。我在用戶以下tempalete:

{{> tabular table=TabularTables.UsersAdmin selector=selector class="table table-striped table-bordered table-condensed"}} 

和客戶端/ lib目錄/ userAdmin.js我加

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

Template.users.rendered = function(){ 

TabularTables.UsersAdmin = new Tabular.Table({ 
name: "User List", 
collection: Meteor.users, 
pub:"users", 
columns: [{data:"roles",title:"Role", 
    render: function (val, type, doc) { 
    return val[0]; 
    }}, 
{ 
    data: "emails", 
    title: "Email", 
    render: function (val, type, doc) { 
    return val[0].address; 
    } 
}], 
}); 

} 

如果我呈現在用戶頁面我得到:

Uncaught ReferenceError: TabularTables is not defined. 
Error: You must pass Tabular.Table instance as the table attribute 
at null.<anonymous> (tabular.js:119) 

我認爲這是一些發佈問題,但是,如果我輸入控制檯:

Meteor.users.findOne().emails[0].address 
Meteor.users.findOne().roles[0] 

這兩個參數都會返回這些函數,因此這些變量可供Admin用戶使用。 任何想法?我用表格錯了嗎?

+0

我刪除了'Template.users.rendered = function()'並沒有幫助 –

回答

1

發現錯誤: 引用和所有都是正確的。只是忘了包括:

TabularTables = {}; 

在頂部。此外,TabularTables代碼應位於客戶端和服務器空間中。

:-o和是。浪費了太多時間!