Created
October 26, 2012 00:25
-
-
Save krotscheck/3956300 to your computer and use it in GitHub Desktop.
Fix for templateCollectionViews
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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