CodesJava

Easy learning with example program codes

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.

 

METHODUSES
attributesTo be used as a DOM element attributes on the view class.
$elTo 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.
delegateEventsTo bind elements to the specified DOM elements with callback methods to handle events.
elTo define which element to be used as the view reference.
extendTo extend the Backbone.view class to create a custom view class.
initializeTo instantiate the view by using new keyword.
removeTo remove a view from the DOM.
renderTo store the logic for rendering a template.
setElementTo specify the existing DOM element to a different DOM element.
templateTo create reusable copies of markup and to provide access to the instance data, while rendering the view.
undelegateEventsTo remove delegate events from the view.

 

Please follow and like us:


Copyright © 2019 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki