Ember - sort array by multiple properties in multiple directions

ember.js, javascript, sorting

Solution

In your ArrayController:

sortProperties: ["propA:asc", "propB:desc"]
sortedModel: Ember.computed.sort("model", "sortProperties");

Then reference `sortedModel` in your template's `#each` handler.

Problem

I need to sort a collection of Ember Models by multiple properties, and not necessary in the same direction/order. I.e. I need to sort by property a in ascending order and by property b in descending. Is there a way to achieve this? Update I tried setting the `sortAscending` property to a array, but it is not working. After looking into the source it seems that this functionality is not supported out of the box(yet).

Original source