- Mastering Backbone.js
- Abiee Echamea
- 236字
- 2021-07-23 14:39:34
Identifying view types
After working with Backbone for a while you can see common use cases for views emerge; they are so common they can be used for different unrelated projects. These views can be extracted and can be used on any project if they are built correctly. Looking at the Backbone documentation, Views do not implement a default render method, so the trick here is to define a set of views with a default render method for different use cases:
- View with model – Render a template with model data.
- View with collection – Render a collection of views with collection data; it should update the list of views automatically when the collection changes.
- Region – This view acts like a container; it points to a particular DOM node and manages the content for that node. It's used to render other views.
- Layout – A layout is composed of one or more regions; it defines an HTML structure to organize where the regions will be placed.
Figure 2.1 shows a simple wireframe for an application; as you can see, it is a very common layout found on web applications and is very useful to understand how the common view types are related.

Figure 2.1: Views, Regions, and Layout relationship
With these foundation views you will have a simple but powerful framework to manage your views, so you won't need to implement the render()
method anymore.
- INSTANT Mock Testing with PowerMock
- Java從入門到精通(第4版)
- Linux網絡程序設計:基于龍芯平臺
- 老“碼”識途
- JS全書:JavaScript Web前端開發指南
- MATLAB 2020從入門到精通
- JavaCAPS基礎、應用與案例
- Learning Probabilistic Graphical Models in R
- Spring MVC+MyBatis開發從入門到項目實踐(超值版)
- .NET 4.5 Parallel Extensions Cookbook
- 軟件工程基礎與實訓教程
- Learning Splunk Web Framework
- Java程序設計及應用開發
- Google Maps JavaScript API Cookbook
- Processing開發實戰