In my application I have a lot of tabular data. The most trivial way to output this tabular data is something like the following:
<table>
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
</tr>
</thead>
<tbody>
{{#each content}}
<tr>
<td>{{firstName}}</td>
<td>{{lastName}}</td>
</tr>
{{/each}}
</tbody>
</table>
This unfortunately creates a bunch of metamorph tags in between the table rows. This in my opinion is not ideal - and there are some situations where this actually breaks.
So I have created two approaches that seem to minimize on these metamorph tags.
- Create a tbody-each helper which passes down the arguments to a CollectionView with a tagName of tbody (Ember Latest - JSFiddle - Code Playground)
- Pass the data down to another array controller with tagName of tbody and an item controller with a tagName tr (Ember Latest - JSFiddle - Code Playground)
How have you dealt with this issue? Do either of these patterns make sense? Is one more ‘The Ember Way’ over the other? Are there any performance implications for either approach?
Thanks.