I'm working of the Base User admin project from: https://github.com/themeteorchef/building-a-user-admin
I want to change the user list table to a dataTable using aldeed:tabular. I have the following in the users tempalete:
{{> tabular table=TabularTables.UsersAdmin selector=selector class="table table-striped table-bordered table-condensed"}}
and in client/lib/userAdmin.js I added
Meteor.isClient && Template.registerHelper('TabularTables', TabularTables);
Template.users.rendered = function(){
TabularTables.UsersAdmin = new Tabular.Table({
name: "User List",
collection: Meteor.users,
pub:"users",
columns: [{data:"roles",title:"Role",
render: function (val, type, doc) {
return val[0];
}},
{
data: "emails",
title: "Email",
render: function (val, type, doc) {
return val[0].address;
}
}],
});
}
If I render the user page I get:
Uncaught ReferenceError: TabularTables is not defined.
Error: You must pass Tabular.Table instance as the table attribute
at null.<anonymous> (tabular.js:119)
I thought the was some publish problem, However, if i type in the console:
Meteor.users.findOne().emails[0].address
Meteor.users.findOne().roles[0]
Both parameters returns the functions, so the variables are available to the Admin user. Any Ideas? Am I using tabular wrong?
Found the error: The referencing and all was correct. Just forgot to include:
TabularTables = {};
At the top. Also the TabularTables code should be in a client and server space.
:-o and Yes. wasted too much time!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.