Skip to content

Instantly share code, notes, and snippets.

@fivetwentysix
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fivetwentysix/e0f97330d5ab1fb5ea73 to your computer and use it in GitHub Desktop.
Save fivetwentysix/e0f97330d5ab1fb5ea73 to your computer and use it in GitHub Desktop.
This sorting code runs really slow after sorting a few times!
DemoApp.PlayersShowController = Ember.ObjectController.extend
needs: 'application'
filteredMatches: ( ->
hero_id = @get('model.filters.hero_id')
if hero_id
@get('model.matches').filterBy('hero_id', hero_id)
else
@get('model.matches')
).property('model.filters.hero_id')
sortedMatches:
Ember.computed.sort('filteredMatches', 'model.sortingPreferences')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment