Meteor SB Admin Theme - Reactive Table


#1

Hi all

I run in some failures but I don´t find the solution. I run meteor with the sb admin theme. In this theme I have to display a table.

Failures: 1.

app.js?hash=d464d2f00e9df37b0e31750511f13d86721710d3:6307 Uncaught TypeError: Cannot read property ‘on’ of undefined
at app.js?hash=d464d2f00e9df37b0e31750511f13d86721710d3:6307
at app.js?hash=d464d2f00e9df37b0e31750511f13d86721710d3:6306
at raphael.min.js (app.js?hash=d464d2f00e9df37b0e31750511f13d86721710d3:6306)
at fileEvaluate (modules-runtime.js?hash=5e485d3e2a49d2506f7ca0df72fcd6a3216a83a5:353)
at require (modules-runtime.js?hash=5e485d3e2a49d2506f7ca0df72fcd6a3216a83a5:248)
at app.js?hash=d464d2f00e9df37b0e31750511f13d86721710d3:6432

Failure 2:

reactiveTable error: argument is not an instance of Mongo.Collection, a cursor, or an array

Failure 3:

aslagle_reactive-table.js?hash=6be162adad36c69867ade7629be15425ce3e42bd:983 reactiveTable error: Couldn’t get fields from an item in the collection on load, so there are no columns to display. Provide the fields option or ensure that the collection has at least one item and the subscription is ready when the table renders.

My code:

Server/Main.js

import { Meteor } from 'meteor/meteor';
import { ApplicationList } from '../imports/applications-list';

Meteor.startup(() => {
  if (ApplicationList.find({}).count() === 0) {
      [
      {Category : "IT ",Systeme : "Service Desk", description : "", bpo_contact : " ", agency : "", layer_group : "Category", business_group : "", departments :  ["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]}
      ].forEach(val => {
          ApplicationList.insert(val);
      });
  }
});

imports/application-list.js


export const ApplicationList = new Mongo.Collection('applications');
if (Meteor.isServer){
    Meteor.publish('applications', function() {
        return ApplicationList.find({});
    });
}

client/main.html (only relevant parts)


<div class="panel-footer">
                                {{> matrix}}
</div>

<template name="matrix">
    {{> reactiveTable collection=applications settings=tableSettings}}
</template>

client/main.js

import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import { ApplicationList } from '../imports/applications-list';

Template.matrix.onCreated(function() {
    this.subscribe('applications');
})
Template.matrix.helpers({
    applications: function(){
        return ApplicationList.find({});
    },
    tableSettings : function () {
       return {
           collection: ApplicationList.find({}),
           rowsPerPage: 250,
           showFilter: true,
           fields: [
            { key: 'Category', label: 'Category'},
            { key: 'Systeme', label: 'Application' },
            { key: 'description', label: 'Short Description'},
            { key: 'bpo_contact', label: 'BPO Person'},
            { key: 'agency', label: 'External Agency'},
            { key: 'layer_group', label: 'Layer Group'},
            { key: 'business_group', label: 'business_group'}
           ]
       };
     }
});

My impression is that he did not find the helpers methods. Due ot the fact that I said rows per page:250 and in the browser he shows 10 per page.

grafik

It would be great if you could take a look and give me some tips.

Best regards

alkru002