我有下表,它工作正常。 Beeing管理員帳戶我發佈了整個Meteor.users集合。我也有一個文件兩個數據庫根/ lib目錄流星:表格集合undefined錯誤
Clients = new Meteor.Collection("client");
Brands = new Meteor.Collection("brand");
它們在/服務器/ lib文件夾
Meteor.publish("pubClients", function(){
return Clients.find();
});
Meteor.publish("pubBrands", function(){
return Brands.find();
});
Meteor.publish("pubUsers", function(){
return Meteor.users.find();
});
在客戶機/ lib目錄公佈了現在這個樣子而訂閱像這樣夾
Meteor.subscribe('pubClients');
Meteor.subscribe('pubBrands');
Meteor.subscribe('pubUsers');
我使用以下模板來注入HTML: {{>表格表= TabularTables.Users選擇=選擇器類=「表表條紋表邊界表「}}
現在,如果我嘗試將Meteor.user更改爲任何客戶端或品牌集合,或者甚至在代碼上方插入console.log(客戶端),我會看到:」客戶端未定義「錯誤。 如果我在運行重新運行應用程序之前鍵入控制檯>客戶端,它可以正常使用Mongo.Collection等。 如果我運行它,我也會在控制檯中獲取未定義的消息。 這是我的代碼(其實aldeed的代碼:)):
TabularTables = {};
Meteor.isClient && Template.registerHelper('TabularTables', TabularTables);
TabularTables.Users = new Tabular.Table({
name: "UserList",
collection: Meteor.users,
pub:"pubUsers"
columns: [
{data: "username", title: "User name"},
{
data: "emails",
title: "Email",
render: function (val, type, doc) {
return val[0].main
}
},
{
data: "emails",
title: "verified",
render: function (val, type, doc) {
return val[0].verified?"☑":"☐";
}
},
{
data: "profile",
title: "Account",
render: function (val, type, doc) {
return val.accType;
}
},
{
data: "profile",
title: "Active",
render: function (val, type, doc) {
return val.active?"active":"pending";
}
},
{
data: "createdAt",
title: "Singned up",
render: function (val, type, doc) {
return moment(val).calendar();
}
},
{
tmpl: Meteor.isClient && Template.bookCheckOutCell
}
]
});
任何想法?
感謝lot.This是我的包列表:
accounts-base 1.1.3 A user account system accounts-password 1.0.5 Password support for accounts aldeed:tabular 0.2.3 Datatables for large or small datasets in Meteor insecure 1.0.2 Allow all database writes by default iron:router 1.0.6 Routing specifically designed for Meteor meteor-platform 1.2.1 Include a standard set of Meteor packages in your app momentjs:moment 2.9.0 Moment.js (official): parse, validate, manipulate, and display dates - official Meteor packaging sergeyt:typeahead 0.10.5_7 Autocomplete package for meteor powered by twitter typeahead.js twbs:bootstrap 3.3.1_2 Bootstrap (official): the most popular HTML/CSS/JS framework for responsive, mobile first projects
我使用這個集合中的應用程序的其他點,它工作正常。由於我安裝了表格軟件包 不知怎的,事情已經失控。我沒有輕微的想法是從一開始。 我現在掙扎了兩天才得到它的工作,但網絡上關於這個包(和大多數Meteor相關主題)的信息很少,我決定發佈這個問題。
你使我的一天!如果在投票之上會有一個按鈕「擁抱」,我也會推它。我意識到現在加載順序至關重要。你可以請推薦我一個文檔或一些東西,以瞭解我可以如何控制這個。 package.js可能? ()我對流星很新穎,而且我還沒有「感覺」框架。再次感謝上千次! – vladblindu
@vladblindu謝謝隊友 – Sasikanth
@vladblindu,要知道文件加載順序訪問此鏈接http://www.meteorsnippets.com/blog/files-load-order-in-meteor – Sasikanth