How to use reactive-table?


I’m new to meteor.

I want to use a package named reactive-table.

reactive-table creates a template which gives me this API call:

{{> reactiveTable collection=myCollection}}

So I only need to fill myCollection with an array of arrays.

Currrently I have an array of arrays inside of a local variable named aCollection:

  Template.pre10.onRendered(function() {
    var myv10 = $('#pre10');
    var myh   = myv10.html();
    var aCollection = Papa.parse(myh);

How do I copy the data from aCollection into myCollection?


The pseudocode would be something like this:

for (a in aCollection)

However, I’m not sure why your code is in the onRendered function. Collections are persistent, so you would be adding data to the collection every time the table is rendered. Instead, you probably want to use Papa to parse your CSV data on the server, insert it into the collection once, and then just display that data on the client.


I understand your syntax.
I dont understand how to get aCollection and myCollection into the same scope.
aCollection is only visible inside the function which holds it.
I need to make aCollection visible outside that function.


I come from the python-world.
My understanding of JS is very weak.
I’m using meteor to learn JS.
Currently I have no idea about how I can move data around inside a meteor app.


Have you followed a Meteor tutorial or looked up anything online? There will be lots of examples of how to fetch data from the server and display it on your page. I recommend starting there, and if you’re still stuck, come back here (or Stack Overflow) and ask a question.


The data I want is already in the DOM so I prefer to avoid the server. I think a session variable might be a good fit for this use-case. But I dont know if I should use a session variable to hold a DOM element that could get as large as a 200k CSV file. In Rails for example, session should be kept below 4k. I think what would work well is a call-back tied to an all-templates-rendered-event. Currently I have access to this: Template.xyx.onRendered() but I want this: AllTemplates.onRendered(). Then I could use jquery to build a big table-element from a bunch of CSV data sitting in a pre-element.