|
@@ -26,43 +26,13 @@ DS.RecordArray = Ember.ArrayProxy.extend({ |
|
|
// The store that created this record array.
|
|
|
store: null,
|
|
|
|
|
|
- init: function() {
|
|
|
- this.contentWillChange();
|
|
|
- this._super();
|
|
|
- },
|
|
|
-
|
|
|
- contentWillChange: Ember.beforeObserver(function() {
|
|
|
- set(this, 'recordCache', []);
|
|
|
- }, 'content'),
|
|
|
-
|
|
|
- contentArrayDidChange: function(array, index, removed, added) {
|
|
|
- var recordCache = get(this, 'recordCache');
|
|
|
- var args = [index, 0].concat(new Array(added));
|
|
|
-
|
|
|
- recordCache.splice.apply(recordCache, args);
|
|
|
- },
|
|
|
-
|
|
|
- contentArrayWillChange: function(array, index, removed, added) {
|
|
|
- var recordCache = get(this, 'recordCache');
|
|
|
- recordCache.splice(index, removed);
|
|
|
- },
|
|
|
-
|
|
|
objectAtContent: function(index) {
|
|
|
- var recordCache = get(this, 'recordCache');
|
|
|
- var record = recordCache[index];
|
|
|
-
|
|
|
- if (!record) {
|
|
|
- var store = get(this, 'store');
|
|
|
- var content = get(this, 'content');
|
|
|
+ var content = get(this, 'content'),
|
|
|
+ clientId = content.objectAt(index),
|
|
|
+ store = get(this, 'store');
|
|
|
|
|
|
- var contentObject = content.objectAt(index);
|
|
|
-
|
|
|
- if (contentObject !== undefined) {
|
|
|
- record = store.findByClientId(get(this, 'type'), contentObject);
|
|
|
- recordCache[index] = record;
|
|
|
- }
|
|
|
+ if (clientId !== undefined) {
|
|
|
+ return store.findByClientId(get(this, 'type'), clientId);
|
|
|
}
|
|
|
-
|
|
|
- return record;
|
|
|
}
|
|
|
});
|
0 comments on commit
7d2f845