Created
March 2, 2012 22:16
-
-
Save tvpmb/1961807 to your computer and use it in GitHub Desktop.
Rendering a model in Backbone??
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
render: function(layout) { | |
var view = layout(this); | |
var themeId = this.options.themeId; | |
/* THIS WORKS, BUT WHY DO I NEED TO LOOP THE COLLECTION?!?! */ | |
this.collection.each(function(theme) { | |
if (theme.id == themeId) { | |
console.log('theme: ', theme); | |
view.insert(new ThemeEditor.Views.PreviewContent({ | |
model: theme | |
})); | |
} | |
}); | |
/* THIS DOESN'T WORK */ | |
var theme = this.collection.get(themeId); | |
view.insert(new ThemeEditor.Views.PreviewContent({ | |
model: this.collection.get(themeId) | |
})); | |
return view.render(); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment