[Solved] How can I programmatically render a template & pass in data attributes?


I’m trying to programmatically render a Blaze template but also pass in the attributes. The regular Blaze.render doesn’t allow that from what I can gather reading source.

Any ideas on how to render this?:

{{> tabular table=MyTable }}

I tried something like this:

// Tabular table object (not template)
var MyTable = new Tabular.Table(options);

// render into the DOM (but cant pass in MyTable)
Blaze.render(Template.tabular, document.getElementById('root'));

also here's the tabular template: ```


Perhaps http://docs.meteor.com/#/full/blaze_renderwithdata can help

var MyTable = new Tabular.Table(options);
var data = {table: MyTable};

Blaze.renderWithData(Template.tabular, data, document.getElementById('root'));

I’m not sure if this exact code will work since I’m not that much familiar with tabular, but this is the gist of rendering a template with a data context


I don’t know how I missed this! Hah! Thanks @serkandurusoy you’re the best!
Hopefully we’ll have the Meteor Tabular DataTables in React soon :smile:


You’re not gonna quit making it easy to onboard react, are you? :wink: