Skip to content

Instantly share code, notes, and snippets.

@brian-mann
Last active August 29, 2015 14:05
Show Gist options
  • Select an option

  • Save brian-mann/e2330973382c302a2812 to your computer and use it in GitHub Desktop.

Select an option

Save brian-mann/e2330973382c302a2812 to your computer and use it in GitHub Desktop.
resortView: ->
@collection.each (model, index) =>
view = @children.findByModel(model)
@moveViewToIndex(view, index) if view._index isnt index
moveViewToIndex: (view, index) ->
view._index = index
sibling = view.$el.siblings().eq(index)
view.$el.insertBefore(sibling)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment