| Server IP : 182.53.201.61 / Your IP : 216.73.217.175 Web Server : Apache/2.2.15 (Fedora) System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686 User : apache ( 48) PHP Version : 5.3.3 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/school-anc/jquerymobile/demos/backbone-requirejs/js/views/ |
Upload File : |
// Category View
// =============
// Includes file dependencies
define([
"jquery",
"backbone",
"../models/CategoryModel"
], function( $, Backbone, CategoryModel ) {
// Extends Backbone.View
var CategoryView = Backbone.View.extend( {
// The View Constructor
initialize: function() {
// The render method is called when Category Models are added to the Collection
this.collection.on( "added", this.render, this );
},
// Renders all of the Category models on the UI
render: function() {
// Sets the view's template property
this.template = _.template( $( "script#categoryItems" ).html(), { "collection": this.collection } );
// Renders the view's template inside of the current listview element
this.$el.find("ul").html(this.template);
// Maintains chainability
return this;
}
} );
// Returns the View class
return CategoryView;
} );