77
Backbone.js View
The Backbone.js Views specify how your data looks like. They represent model’s data to the users. They can be used with any JavaScript template library. They handle users input events, bind events and methods, render model and collection and interact with users.
Following is a list of methods that can be used to manipulate the Backbone.js views:
Indexndex | Method | Description |
---|---|---|
1. | extend | It is used to extend the Backbone.view class to create a custom view class. |
2. | initialize | It is used to instantiate the view by using new keyword. |
3. | el | It defines which element to be used as the view reference. |
4. | $el | It represents the jQuery object for the view’s element. |
5. | setElement | It specifies existing DOM element to a different DOM element. |
6. | attributes | They can be used as DOM element attributes on the view class. |
7. | $(jQuery) | It is used as selector that contains $ function and runs queries within the view’s element. |
8. | template | While rendering the view, template creates reusable copies of markup and provides access to instance data. |
9. | render | It contains the logic for rendering a template. |
10. | remove | It is used to remove a view from the dom. |
11. | delegateEvents | It binds elements to the specified DOM elements with callback methods to handle events. |
12. | undelegateEvents | It is used to remove delegate events from the view. |
Next TopicBackbone.js Utility