Backbone.js View

 

There are mainly seven modules in the Backbone.js Architecture: HTTP Request, Router, View, Events, Model, Collection and Data Source. A user request is made using a router. The response to these requests is displayed by a user interface, often called Views. The View module in the Backbone.js view does not only display the response. It also specifies how to display and what to display from the concerned application. Instead of having HTML markup for the application, the View offers to the user with the model’s data. Being unaware of the HTML and CSS, the View displays the looks of the concerned data model. If a change has occurred in the model, each view can be updated independently, and thus this process does not require the reloading of the whole page.

In simple words, the View displays the response to the users’ requests and also specifies how to display and what to display from an application. There are certain methods to manipulate, modify and utilise the Backbone.JS View.

 

METHOD USES
attributes To be used as a DOM element attributes on the view class.
$el To represent the jQuery object for the view’s element.
$(jQuery) To be used as a selector that contains $ function and runs queries within the view’s element.
delegateEvents To bind elements to the specified DOM elements with callback methods to handle events.
el To define which element to be used as the view reference.
extend To extend the Backbone.view class to create a custom view class.
initialize To instantiate the view by using new keyword.
remove To remove a view from the DOM.
render To store the logic for rendering a template.
setElement To specify the existing DOM element to a different DOM element.
template To create reusable copies of markup and to provide access to the instance data, while rendering the view.
undelegateEvents To remove delegate events from the view.