I have an application structure that looks exactly like the blaze tutorial. I’m using aldeed:tabular and put my TabularTables common code under imports/api/getlogins.js like this:
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { Logins } from '../api/getlogins.js';
import './logins.html';
if (Meteor.isClient) {...}
TabularTables.Logins = new Tabular.Table({
name: "Logins",
collection: Logins,
pageLength: 500,
...
});
But getting this error when the page has loaded:
I20160816-11:02:30.789(1)? Exception from sub tabular_getInfo id 7P8KT77cxci2pKp5x Error: No TabularTable defined with the name “Logins”. Make sure you are defining your TabularTable in common code.
I20160816-11:02:30.910(1)? at Subscription._handler (packages/aldeed_tabular/server/tabular.js:60:1)
I20160816-11:02:30.911(1)? at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1711:12)
I20160816-11:02:30.911(1)? at Subscription._runHandler (packages/ddp-server/livedata_server.js:1026:17)
I20160816-11:02:30.912(1)? at Session._startSubscription (packages/ddp-server/livedata_server.js:845:9)
I20160816-11:02:30.913(1)? at Session.sub (packages/ddp-server/livedata_server.js:617:12)
I20160816-11:02:30.913(1)? at packages/ddp-server/livedata_server.js:551:43
Thanks @smeijer, I was just trying that as you wrote this post. I put it under /lib, but I’m using Meteor 1.4 and I read somewhere that this is not recommended anymore. Is that true?
For now though, it does work by putting it under lib.
If it works like that, you at least found the problem.
You should be able to place it into the imports dir as well. But you must be sure to import the script in your startup script (usually main.js), or even better; in the Templates where you use it.
Also be sure to place import meteor/aldeed:tabulartables in the file you’re quoting above. As TabularTables now come from the global scope, which shouldn’t exists.
Thanks @smeijer, actually as I solved that problem, I noticed that some of the css from bootstrap and datatables.net stopped working. I don’t have actual files of those, but just the CDNs in the client/logins.html file: