Skip to content

Commit

Permalink
Use SC.Enumerable's sortProperty to sort objects so that this works o…
Browse files Browse the repository at this point in the history
…n any SC.Enumerable not just native arrays.
  • Loading branch information
LogicWolfe authored and Charles Jolley committed Jun 16, 2010
1 parent 5435db7 commit e9af647
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions frameworks/desktop/views/select_field.js
Expand Up @@ -99,13 +99,7 @@ SC.SelectFieldView = SC.FieldView.extend(
sortObjects: function(objects) {
if(!this.get('disableSort')){
var nameKey = this.get('sortKey') || this.get('nameKey') ;
objects = objects.sort(function(a,b) {
if (nameKey) {
a = a.get ? a.get(nameKey) : a[nameKey] ;
b = b.get ? b.get(nameKey) : b[nameKey] ;
}
return (a<b) ? -1 : ((a>b) ? 1 : 0) ;
}) ;
objects = objects.sortProperty(nameKey);
}
return objects ;
},
Expand Down

0 comments on commit e9af647

Please sign in to comment.