I am looking at this example here:
http://emberjs.jsbin.com/bihemir/edit?html,css,js
Content is made with the tableContent function. How would you add to this table dynamically? i.e call tableContent with five new values to be added to a new row when you need to dynamically add a new row:
tableContent: function(newDate, newOpen, newHigh, newLow, newClose) {
var generatedContent = [];
generatedContent.push({
date: newDate,
open: newOpen,
high: newHigh
low: newLow,
close: newClose
});
}
return generatedContent;
}.property()
bind an action when you want to add a new row. The changes you need to do is
1.instead of making generatedContent as normal array make it Ember Array.
2.make generatedContent as a controller property.
3.use pushObject instead of push
4.call a user defined action addRow when needed a dynamic row.
The controller looks like