Created
December 22, 2011 17:44
-
-
Save stevenpsmith/1511157 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exercise.ActivityListView = Backbone.View.extend({ | |
tagName: 'ul', | |
id: 'activities-list', | |
attributes: {"data-role": 'listview'}, | |
initialize: function() { | |
this.collection.bind('add', this.render, this); | |
this.template = _.template($('#activity-list-item-template').html()); | |
}, | |
render: function() { | |
var container = this.options.viewContainer, | |
activities = this.collection, | |
template = this.template, | |
listView = $(this.el); | |
$(this.el).empty(); | |
activities.each(function(activity){ | |
listView.append(template(activity.toJSON())); | |
}); | |
container.html($(this.el)); | |
container.trigger('create'); | |
return this; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment