When to use Backbone.View vs Backbone.Marionette.ItemView?

I am working on my first attempt to use Backbone.Marionette and wonder if there is a reason to use Backbone.Marionette.ItemView when a simple Backbone.View is enough?

Thank!

+5
source share
1 answer

Marionette ItemView provides a method renderand closeby default, which does several things for you.

render performs the following (by the way):

1) Marks the view as! this.isClosed (related to displaying views in regions, another Marionette concept)

2) Triggers before and after rendering events

3) Calls a method serializeDatato receive data (by default, data from this.modelor is used this.collection.

4) (, TemplateCache) Marionetter.Renderer

5)

"" render .

, CollectionView/ItemView ( ) CompositeView/ItemView, ItemView.

, , . , Marionette , , :

var myView = new MyView();

// render and display the view
MyApp.mainRegion.show(myView);

// closes the current view
MyApp.mainRegion.close();

MyView - Item Item, . Backbone View, , , , , , .

ItemView - .

+16

All Articles