Skip to content

Instantly share code, notes, and snippets.

@jaehess
Created December 9, 2010 19:16
Show Gist options
  • Select an option

  • Save jaehess/735177 to your computer and use it in GitHub Desktop.

Select an option

Save jaehess/735177 to your computer and use it in GitHub Desktop.
DataSource only fires once
MyApp.List = SC.Record.extend({
name: SC.Record.attr(String)
,itemKeys: SC.Record.attr(Array)
,primaryKey: 'key'
,addItems: function(items){
var refs = this.get('itemKeys') || new Array,
keys = items.getEach('key');
keys.forEach(function(key){
if(refs.indexOf(key) < 0){
refs.push(key);
}
}, this);
this.set('itemKeys', refs);
}
}) ;
@jaehess
Copy link
Author

jaehess commented Dec 9, 2010

This code is taking an array of records, and pushing their keys into this records array of itemKeys. This doesn't seem to fire the datasource, outside of the first call. Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment