Should:
Should Not:
Should:
Should Not:
Should:
Should Not:
Object - if you’re going to create a Class and want it to have initialize and events, use ObjectBehavior - handle user interactions via a View in a decoupled way. Can apply to Model or Collection events as well. A set of behaviors can be grouped together.Behaviors - attaches your Behavior instances to a given View, especially if they are in their own file in a different folder.Callbacks - manage callbacks in a safe Async mannerView.bindUIElements - Instead of having jQuery selectors hanging around in the view’s code you can define a ui hash that contains a mapping between the ui element’s name and its jQuery selector. Afterwards you can simply access it via this.ui.elementNameCollectionView - will loop through all of the models in the specified collection, render each of them using a specified childViewCompositeView - used to wrap a CollectionView and an ItemView in a template that you decide. See the difference below.ItemView - An ItemView is a view that represents a single itemObject - if you’re going to create a Class and want it to have initialize and events, use ObjectController - While this Marionette object has no relation to the MVC design pattern, it is probably the best to use for the MVC Controller.Callbacks - manage callbacks in a safe Async mannerRegions - display a View at a specified point in the DOM, allowing different Views to easily be swapped in and out from that point in the DOM.Object - if you’re going to create a Class and want it to have initialize and events, use ObjectRegions - manage, show and destroy Views in your applicationRegionManager - manage a number of Region objects within an applicationRenderer - the render method renders a template with or without dataTemplateCache - caches templates for fast retrievalLet this help you decide which is more appropriate to use:
A CollectionView is for rendering a repeating list of models, each of which has the same representation/template.
A CompositeView is for rendering a repeating list of models as well, but also to render some view/template which wraps the list.
Links to other explanations of CompositeView:
A Region can be used to display a LayoutView. A layout will also contain regions. This creates a nested hierarchy that can extend infinitely.
A Region displays a View at a specified point in the DOM, allowing different Views to easily be swapped in and out from that point in the DOM.
A LayoutView extends from ItemView, meaning that it is designed to render a single template. The difference between a LayoutView and an ItemView is that the LayoutView contains Regions.
When you define a LayoutView, you give it a template but you also specify Regions that the template contains. This allows you to display other Views in the Regions that the LayoutView defined.
Links to other explanations of CompositeView: