Book Image

Backbone.js Patterns and Best Practices

By : Swarnendu De
Book Image

Backbone.js Patterns and Best Practices

By: Swarnendu De

Overview of this book

Table of Contents (19 chapters)
Backbone.js Patterns and Best Practices
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Precompiling Templates on the Server Side
Index

Using Marionette's ItemView, CollectionView, and CompositeView


Marionette (http://marionettejs.com/) is a composite application library for Backbone.js. Developed by Derick Bailey, it is a collection of common patterns and solutions to Backbone problems. It is a great library and lots of developers use it for their Backbone-based applications.

One important thing about Marionette is that it offers several separate packages for views, regions, and so on, and allows you to use any of them freely without requiring the complete library. In this section, we will explore Marionette's ItemView, the CollectionView, and the CompositeView functionalities. These views solve a number of problems we discussed in the previous sections.

ItemView

ItemView represents a single view for an item, it can be a model view or a collection view. It extends the Marionette.View class, which is a core view with a number of reusable functions. Marionette.View takes care of triggering, delegating, and undelegating events...