I am currently trying to propagate a table row <tr>
template into a <tbody>
tag. Here is an example:
HTML:
<table>
<tbody data-bind="template: { name : 'tableTemplate', foreach : tableRow }">
</tbody>
</table>
<script type="text/html" id="tableTemplate">
<tr>
<!-- First Name -->
<td data-bind="text: firstName"></td>
<!-- Last Name -->
<td data-bind="text: lastName"></td>
</tr>
</script>
DurandalJS:
define(function(require) {
var self = this;
self.app = require('durandal/app');
return {
tableRow: ko.observableArray([
{ firstName: "DemoFirstName" , lastName: "ExampleLastName" },
{ firstName: "ExampleFirstName", lastName: "DemoLastName" }
]);
//viewAttached and other non-applicable console log functions here
};
});
Everything in the HTML will properly data-bind until it hits the table; all data-binds afterwards become dead.
I am rather new to Durandal, and am learning as I go.