Skip to content

Instantly share code, notes, and snippets.

@redwraith2
Created July 8, 2015 13:42
Show Gist options
  • Save redwraith2/c045711b2ef25fe3b347 to your computer and use it in GitHub Desktop.
Save redwraith2/c045711b2ef25fe3b347 to your computer and use it in GitHub Desktop.
#When using UI Hooks, the docs will tell you to do it like this:
#This is wrong, but will work unless you are doing something that involves positioning. Namely autoscrolling behavior.
@find('#container')._uihooks = {
insertElement: ->
$(node).insertBefore(next)
#I researched how MDG does inserts themselves. They do it more like this:
#This works without an issue if you've implemented autoscrolling on this collection via template-level subscriptions.
#This is because this uses DOM insert rather than JQuery.
#It also, unfortunately, requires an additional piece of information - though one you likely already have! $('#container')
$('#container')[0].insertBefore(node, next)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment