Skip to content

Commit

Permalink
[skip] Stopped sorting collections by default (10m)
Browse files Browse the repository at this point in the history
  • Loading branch information
boblail committed Feb 8, 2016
1 parent 5961e1e commit 64db810
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions vendor/assets/javascripts/neat/collection_editor.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ KEYS = {
# viewPath - by default this is set to resource
#
class window.Neat.CollectionEditor extends Backbone.View
sortedBy: 'name'
sortOrder: 'asc'
sortAliases: {}
templateOptions: {}
Expand Down Expand Up @@ -93,11 +92,14 @@ class window.Neat.CollectionEditor extends Backbone.View

rerenderPage: (page)->
page = @paginator.getCurrentPage() unless _.isNumber(page)
sortField = @sortField(@sortedBy)
items = @collection.sortBy (model)->
val = model.get(sortField) || ''
if _.isString(val) then val.toLowerCase() else val
items.reverse() if @sortOrder == 'desc'
if @sortedBy
sortField = @sortField(@sortedBy)
items = @collection.sortBy (model)->
val = model.get(sortField) || ''
if _.isString(val) then val.toLowerCase() else val
items.reverse() if @sortOrder == 'desc'
else
items = @collection.toArray()
@paginator.init items, page


Expand Down

0 comments on commit 64db810

Please sign in to comment.