Created
December 2, 2011 20:49
-
-
Save starzonmyarmz/1424779 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Views | |
var SchoolsView = Backbone.View.extend({ | |
el: $('#ridley_schools table'), | |
collection: new SchoolList(), | |
matchingSchools: $('#school_row_template').html(), | |
initialize: function(){ | |
_.bindAll(this, 'render'); // to solve the this issue | |
this.collection.bind('reset', this.render); | |
this.collection.fetch({ | |
error: function() { | |
console.log('error fetching school data'); | |
} | |
}); | |
}, | |
events: { | |
'click button.compare': 'addSchoolToCompare' | |
}, | |
render: function(){ | |
// console.log(this.collection.toJSON()); | |
var tmpl = _.template(this.matchingSchools, { data : this.collection.toJSON() } ); | |
$(this.el).html(tmpl); | |
return this; | |
}, | |
addSchoolToCompare: function(){ | |
console.log('clicked'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment