Sorting

Ember

ArrayController

Estella Madison / @chicagoing

It's just an ArrayProxy with

ControllerMixin
SortableMixin

SortableMixin

exposes

sortProperties
sortAscending
sortFunction
arrangedContent

Example

@baaz

wrote about a better approach using

Ember.computed.sort

Ember.computed.sort

A macro in the reduce_computed_macros package


Two parameters:

itemsKey (string)
sortDefinition (string or function)

Example

Advantages of using

Ember.computed.sort

Use different sort criteria for sorted properties

You can use a custom comparison function

Sort by computed properties (example)

That's it.


Questions?

Sorting Ember ArrayController

By Estella Gonzalez Madison

Sorting Ember ArrayController

Exploring various option for sorting Ember.ArrayController

  • 2,502