Skip to content

Instantly share code, notes, and snippets.

Created May 29, 2014
What would you like to do?
Sortable example for ember.js
WidgetsController = Ember.ArrayController.extend
sortProperties: ["user.firstName"]
sortAscending: true
sortBy: (sortProperties) ->
old = @get("sortProperties")
@set "sortProperties", [sortProperties]
@toggleProperty "sortAscending" if sortProperties in old
return false
Title <button {{action "sortBy" "title"}}>Sort</button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment