Meteor dynamically adding a new table row…

Issue solved. Actually it was my lack of understanding that was the real issue. So to add a new row to an existing template table I used the following code:

Template.tables.events({
‘click .addRow’: function(event, template){
//alert(‘addRow click’);
var inst = Session.get(‘tablesTemplateInstance’);
var column = 4;
var html = “<tr>”;
for(var c=0; c<column; c++){
html = html + “<td><input value=’0′ /></td>”
};
html = html + “</tr>”;
//alert(Spacebars.SafeString(html));
template.$(‘#card tr:last’).after(html);
}
});

The key learning for me was to. append the jquery to the event returned template object and to return an HTML string. Returning a Spacebars.SafeString does not work.

Leave a comment