Reputation: 612
<script type="text/x-handlebars" data-template-name="item-view">
{{#with view.content.json}}
<tr>
<td>{{unbound artistName}}</td>
<td>{{unbound price}}</td>
<td>{{unbound primaryGenreName}}</td>
<td>{{unbound version}}</td>
</tr>
{{/with}}
</script>
<table>
<script type="text/x-handlebars">
{{view Em.CollectionView itemViewClass="App.ItemView" contentBinding="App.itemsController"}}
</script>
</table>
The HTML table tags in the above template are stripped out using ember-1.0.pre.js. Is there a more appropriate pattern than this for outputting a table of results where there are many values?
The post Handlebars.js: Nested templates strip “safe” HTML appears relevant to the subject of preserving the tags but Ember adds its own abstraction on top of this.
Upvotes: 0
Views: 536
Reputation: 2008
Looking at the ember docs, I think this what you are trying to find. You should be able to substitute a bunch of different list types in depending on your goal.
anUndorderedListView = Ember.CollectionView.create({
tagName: 'tbody',
content: ['A','B','C','D'],
itemViewClass: Ember.View.extend({
templateName: 'item-view'
})
});
Upvotes: 1