Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fix for templateCollectionViews
// This gets added at the end of the if(content) block in arrayContentDidChange
// On nested records we additionally have to do a pass to see whether the order
// now matches.
this._refreshNestedRecordOrder();
// This is a new method.
_refreshNestedRecordOrder : function() {
// Get the content, or the content inside of the arrangedObjects property.
var content = this.getPath('content.content') || this.get('content');
var childViews = this.get('childViews');
if (!content || !childViews) {
return;
}
if (SC.kindOf(content, SC.ChildArray)) {
var len = content.get('length');
for ( var i = 0; i < len; i++) {
var item = content.objectAt(i);
var view = childViews.objectAt(i);
if (view && item && view.get('content') !== item) {
view.set('content', item);
}
}
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment