Sorting ArrayControllers in Ember

May 3, 2013

I have an ArrayController in Ember (1.0.0.rc-3) and I want it to always be sorted.

The object in the ArrayController is this one, and I want to sort by points:

App.SeedResult = Ember.Object.extend({
    band_id: null,
    band_name: null,
    points: null
});

It is possible to have the ArrayController automatically keep the set sorted by simply adding sortProperties and sortAscending properties to it:

App.seedController = Ember.ArrayController.create({
    content: [],
    sortProperties: ['points'],
    sortAscending: false,
);

References