Last active
December 18, 2015 00:59
-
-
Save davemo/5700294 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
DataTable = Backbone.View.extend({ | |
initialize: function() { | |
this.collection.on("reset", this.renderTable); | |
}, | |
renderTable: function() { | |
this.collection.each(function(data) { | |
this.$("tbody").append("<tr><td>" + data.fieldOne "</td></tr>"); | |
}, this); | |
} | |
}); | |
var table = new DataTable({ collection: someCollection, el: "#some-container" }); | |
someCollection.fetch(); // triggers the reset when completed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment