Skip to content

Instantly share code, notes, and snippets.

@sevifives
Created June 2, 2011 17:43
Show Gist options
  • Save sevifives/1004882 to your computer and use it in GitHub Desktop.
Save sevifives/1004882 to your computer and use it in GitHub Desktop.
YourCustomView = SC.View.extend({
yourArrayOfContent: [],
contentKey: 'foo',
createChildViews: function () {
var key = this.get('contentKey');
var kids = this.get('yourArrayOfContent');
var self = this;
var childViews = [];
kids.forEach(function (kid) {
var view = self.createChildView(SC.View,{
contentBinding: SC.Binding.from('%@'.fmt(key),kid)
});
childViews.push(view);
},this);
this.set('childViews',childViews);
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment