JSFiddle - React, Tailwind, and code Playground
by StevenSanderson
HTML
<script src="http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"></script>
<script src="http://cloud.github.com/downloads/SteveSanderson/knockout/knockout-2.0.0.js"></script>
<h1>Table Test</h1>
<table>
<thead>
<th>Name</th>
<th>Value</th>
</thead>
<tbody>
<!-- ko if: filters().length <= 0 -->
<tr><td colspan="2">Nothing defined.</td></tr>
<!-- /ko -->
<!-- ko foreach: filters -->
<tr>
<tr class="gridrow">
<td data-bind="text: name"></td>
<td data-bind="text: value"></td>
</tr>
</tr>
<!-- /ko -->
</tbody>
</table>
JavaScript
$(function() {
viewModel = {
filters: ko.observableArray([
{ name: 'Joe', value: 5 },
{ name: 'Mary', value: 2 }
])
};
ko.applyBindings(viewModel);
});