As stated in the latest Marionette docs:
CompositeView
is deprecated. You should use thereplaceElement
option onRegion.show
and render aCollectionView
into a region inside aView
to achieve this functionality.
I still can't understand how CompositeView
functionality should be achieved now.
Previously, CompositeView
was perfect for using with such template:
<script id="table-template" type="text/html">
<table>
<% if (items.length) { %>
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<% } %>
<tbody></tbody>
<tfoot>
<tr>
<td colspan="3">some footer information</td>
</tr>
</tfoot>
</table>
new MyCompositeView({
template: "#table-template",
templateContext: function() {
return { items: this.collection.toJSON() };
}
// ... other options
});
If we decide to use LayoutView
instead of CompositeView
then we need to code manually a lot of event bindings (for example to show / hide table header based on number of items in collection). This makes things harder.
Are there any clean and not complicated ways to live without CompositeView
?
Thank you for any help or advice.