No data in tabular

Hi,
I’m having troubles of using aldeed:tabular.
I’m following the example of this page : https://atmospherejs.com/aldeed/tabular
I completed it with my mongo collection, but there is no data showing up ! I got a Processing popup and that’s it.
Here is some code :

booksTab.js :

   TabularTables = {};
   Books= new Mongo.Collection('default.players');

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

   TabularTables.Books = new Tabular.Table({
       name: "BookList",
       collection: Books,
       columns: [
           {data: "_id", title: "Title"},
           {data: "name", title: "Author"},
           {data: "score", title: "Copies Available"},


       ]
   });

booksTab.html

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

What am i doing wrong ?! :frowning:

Everything looks okay to me in your snippet. That being said, is this the majority of your code? If not can you post your full JS/HTML files? I just want to make sure there isn’t something else interfering. Please also confirm that your Books (default.players) collection exists and has data in Mongo.

Hi Hwillson and thx for your reply.

To be honest, this is my whole code ! :]
Yes, my default.players db exist in mongo and data can be seen in mongochef… :confused:

Okay - I’ve never witnessed this problem with Tabular, but it looks like others have:

I read it, but i’m not sure we got the same issues. Apparently they have their data displayed, but the Processing popup still on top.

I guess the problem is my mind… I don’t get it !

I tried an other component : the aslagle:reactive-table
It is even easier than tabular and seems to be perfect for my usage. So I tried to play with… but the table still empty !

I asked myself if my collection returned right the elements, so I did an manual find to print some content, and it works ! So why in this table, there is nothing ?! :frowning:
I’m pretty sure now the problem is the same than with tabular ! Am I dummy or what ? :confused:

html code :

<head>
  <title>testReactiveTable</title>
</head>

<body>
  <h1>Here is my players !</h1>

  {{> myTemplate}}
</body>

<template name="myTemplate">
    
    {{> reactiveTable collection=default.players rowsPerPage=5}} // the real name of my collection
    {{> reactiveTable collection=Players rowsPerPage=5}}   // to hit directly on the new Mongo.Collection('default.players') element !

    <p>test bellow</p>
    {{#each records }}
        <p>name : {{name}} - score : {{score}}</p>
    {{/each}}
    <p>end of test</p>
</template>

js code

Players = new Mongo.Collection('default.players'); // runs on both client and server

if (Meteor.isClient) {

    Template.myTemplate.onCreated(function () {
        Meteor.subscribe("default.players");
    });

    Template.registerHelper('records', function (user) {
        return Players.find({});
    });

    Template.myTemplate.helpers({
        players: function () {
            return Players.find();
        }
    });
}

if (Meteor.isServer) {

    Meteor.publish("default.players", function publishFunction() {
        return Players.find();
    });
}

Here is my result :

Thanks to any advices

2 things:

a) You’re attempting to reference your players helper, so make sure you use a lower case ‘p’:

{{> reactiveTable collection=players rowsPerPage=5}}

b) Based on the code you’re showing reactive-table won’t be able to get the fields list (check your browser console for errors). Add/change the following:

html:

{{> reactiveTable collection=players fields=fields rowsPerPage=5}}

js:

  ...
  Template.myTemplate.helpers({
    ...
    fields() {
      return ['firstName']; // replace with fields you want to show in table columns
    }
    ...
  });
  ...

Ok… sometime we haven’t to get it, cause it worked today after my comp restart… :expressionless:

But you were right : I quit my code yesterday with this two new lines :

{{> reactiveTable collection=records rowsPerPage=5}}
{{> reactiveTable collection=players rowsPerPage=5}}

the both didn’t shown anything yesterday, but today they worked properly !

So yep, reactiveTable doesn’t understand the default.players table (which is the real db’s name). This should be working reading the doc…
But it understands the plug with helpers players and records .

Anyway, thanks for your answers :slight_smile: