[solved] Strange problem: ``aldeed-tabular`` does not work right within "all-in-packages" directory-structure

Hi guys,

I am trying to switch my project to an all-in-packages structure
and ran into a problem with an aldeed:tabular.

The problem is that custom-table-cells (defined within ... new Tabular.Table({... are NOT being rendered when the tabular-definition is being placed within the package (/packages/mypackage/lib/).
The exact same file works when being placed within /lib/

This is an excerp of the file:

  columns: [
    {
      data: 'this',  // set data for sort-option & template-context!
      tmpl: Meteor.isClient && Template.templateColumnName,

Really really strange stuff - I must be doing something wrong.

Any ideas where the problem might be?

in your package require order I suppose
btw placing within “lib” folder in package does not matter.
Load order is defined in package.js

Well… strange thing is that the tubalar table itself is rendered… it just does NOT render the custom cell, just as if Template.* is undefined… maybe it is package scope?

and did you load that template html file before table JS ?

this is how the package.js loads the files:

  // PACKAGE-DEPENDENCIES
  api.use([
    // LIB (Layer 1)
    'lib',  // loads aldeed:tabular and does ``api.imply()``

  ]);

  // FILES
  // SHARED files (client & server)
  api.addFiles([
    'lib/collection.js',
    'lib/table.js',  // table definition
  ]);

  // SERVER files
  api.addFiles([
      'server/publications_and_allows.js',
  ], ['server']);

  // CLIENT files
  api.addFiles([
    'client/table_list.js',
    'client/table_list.html',
  ], 'client');

with the .html I then say:

{{> tabular table=TabularTables.CollectionName class="table table-hover table-striped table-bordered table-condensed table-responsive display responsive"}}

The table renders BUT not the templateCells

and when you switch file order of table_list.js and table_list.html?
Cause you need to load html first in any templates…

2 Likes

nope… still does NOT do it… damn…

FINALLY… what a stupid mistake and @shock was totally right - It was loading order!
And to be honest - I have lost way tooo much time on that one!!! :hushed:

BIG learnings: Always load .html templates first before referencing to them in any other .js files.

This all-in-packages-structure really forces you think about that sh**…

If anyone else stumbles upon this - this is the way to do it:

// PACKAGE-DEPENDENCIES
  api.use([
    // LIB (Layer 1)
    'lib',  // loads aldeed:tabular and does ``api.imply()``

  ]);

  // FILES
  // CLIENT files
  api.addFiles([
    'client/table_list.html',  // put this file first (containing the cell-template) first in order for ``Template.templateColumnName`` to find it
    'client/table_list.js',
  ], 'client');

  // SHARED files (client & server)
  api.addFiles([
    'lib/collection.js',
    'lib/table.js',  // table definition
  ]);

  // SERVER files
  api.addFiles([
      'server/publications_and_allows.js',
  ], ['server']);