2015-01-10 2 views
0

다음 표는 정상적으로 작동합니다. 관리자 계정으로 전체 Meteor.users 컬렉션을 게시했습니다. 또한 그들은 클라이언트/lib에이 같은/서버/lib 폴더Meteor-aldded : 표 컬렉션 오류 정의

Meteor.publish("pubClients", function(){ 
    return Clients.find(); 
}); 
Meteor.publish("pubBrands", function(){ 
    return Brands.find(); 
}); 
Meteor.publish("pubUsers", function(){ 
    return Meteor.users.find(); 
}); 

이 같은 지금 게시 및 구독

Clients = new Meteor.Collection("client"); 
Brands = new Meteor.Collection("brand"); 

루트/lib에 파일에 두 개의 데이터베이스를 {{> 표 테이블 = TabularTables.Users 선택 = 선택 클래스 = "테이블 테이블 스트라이프 테이블 테두리가 테이블 : 나는 HTML을 주입하기 위해 다음과 같은 템플릿을 사용하고 폴더

Meteor.subscribe('pubClients'); 
Meteor.subscribe('pubBrands'); 
Meteor.subscribe('pubUsers'); 

-condensed "}}

이제 Meteor.user를 Clients 또는 Brands 컬렉션으로 변경하거나이 코드 위에 console.log (클라이언트) 코드를 삽입하려고하면"클라이언트가 정의되지 않았습니다. "라는 메시지가 나타납니다. 오류. 콘솔에서> 클라이언트를 실행하기 전에 클라이언트를 실행하면 응용 프로그램이 Mongo.Collection 등에서 정상적으로 작동합니다. 실행하면 콘솔에서도 정의되지 않은 메시지가 표시됩니다.

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 
    } 
] 
}); 

어떤 아이디어 : 이 내 코드는 (사실의 aldeed 코드 :))인가?

감사는 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 관련 주제)에 대한 웹상의 정보가 거의 없다. 잘 모르겠어요

답변

1

루트/lib 폴더에

같은 동일한 파일의 컬렉션을 초기화 한 후 표 코드를 작성하려고로드 순서 문제처럼 보인다

Clients = new Meteor.Collection("client"); 
Brands = new Meteor.Collection("brand"); 


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

    TabularTables.Users = new Tabular.Table({ 
    name: "UserList", 
    collection: Meteor.users, //Clientsor Brands 
    pub:"pubUsers" 
    columns: [ 
    {data: "username", title: "User name"}, 
    { 
     data: "emails", 
     title: "Email", 
     render: function (val, type, doc) { 
     return val[0].main 
     } 
    }, 
+0

당신 내 하루 만들었 어 !!!! 만약 투표의 상단에 "Hugs"버튼이 있다면 나는 그것을 밀어 낼 것입니다. 로드 순서가 중요하다는 것을 알게되었습니다. 제가 이것을 제어 할 수있는 방법을 배우려면 의사 나 다른 어떤 것을 권유 해주십시오. 아마도 package.js일까요?() 나는 유성에 꽤 새롭고 아직 프레임 워크를 "느끼지"못한다. 천 번 다시 감사드립니다! – vladblindu

+0

@vladblindu 감사 메이트 – Sasikanth

+0

@vladblindu, 파일로드 순서를 알고 싶다면 다음 링크를 방문하십시오 : http://www.meteorsnippets.com/blog/files-load-order-in-meteor – Sasikanth