With the data layer in place, and a basic understanding of events, let’s look at Backbone views to build DOM nodes and capture events from users.
The goal of this chapter is summarized pretty good by a paragraph from Backbone’s documentation at http://backbonejs.org#View :
The general idea is to organize your interface into logical views, backed by models, each of which can be updated independently when the model changes, without having to redraw the page.
A difficult subject is the point of “organizing” views. For example, for the interface of Munich Cinema, we will need a kind of “collection view” that renders a Backbone collection instead of a simple model.
In the ecosystem of Backbone.js, there are several plugins that can help you with building advanced collection views. And, we will come to the use of plugins soon. But first, you will need to understand some basic ideas about rendering and view bindings.
Therefore, we will discuss in this chapter:
In this chapter, you are combining DOM manipulation with jQuery and Backbone for the first time. There are other libraries to manipulate the DOM, such as Zepto.js. Avoiding jQuery can be interesting if you develop a mobile app.
For the use case of Munich Cinema, jQuery will work fine. You can import ...