Skip to content

Instantly share code, notes, and snippets.

@sevifives
Created February 1, 2012 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sevifives/1718649 to your computer and use it in GitHub Desktop.
Save sevifives/1718649 to your computer and use it in GitHub Desktop.
SC.ListItem.extend({
contentBinding: SC.Binding.from('YourApp.yourDynamicArrayController'),
exampleView: YourApp.CustomListItemView.extend({
staticDataBinding: SC.Binding.oneWay('YourApp.yourStaticDataController')
})
})
YourApp.CustomListItemView = SC.ListItemView.extend({
staticData: null,
createChildViews: function () {
var content = this.get('content'); // this is the content from the dynamic controller
var staticData = this.get('staticData'); // this is the data from the static controller
var kids = [];
var label = this.createChildView(SC.LabelView, {
titleBinding: SC.Binding.from('value',content)
});
kids.push(label);
var somethingStatic = this.creatChildView(SC.LabelView, {
titleBinding: SC.Binding.from('property',staticData)
});
kids.push(somethingStatic);
this.set('childViews',kids);
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment