Sorting on itemController's property doesn't work


#1

This one is quite annoying. Am I doing something wrong or is it a bug or limitation in Ember? I cannot sort on properties defined in itemController. Example:

App.FooBarsController = Ember.ArrayController.extend({
    itemController: "fooBar",
    sortProperties: ["total"]
});

App.FooBarController = Ember.ObjectController.extend({
    total: Ember.computed.alias("nestedObjects.length")
});

Then in handlebars I tried all of the following without any success:

{{#each}}
{{#each controller}}
{{#each arrangedContent}}
{{#each itemController="fooBar"}}
{{#each controller itemController="fooBar"}}
{{#each arrangedContent itemController="fooBar"}}

Any ideas?


#2

See https://github.com/emberjs/ember.js/issues/4308

For now, use Ember.computed.sort


#3

Wasn’t aware of Ember.computed.sort. That should do the job. Thanks!