YUI: Sortable Nested List Widget

Update: There was an issue with Opera crashing on this demo.. It has now been fixed..

After posting my last example of Nested Drag Drop Events, I received several emails asking how to create sortable nested lists. So here you are.

Just drag any of the list items below and when you drop them, it will resort. Also note that you have to drop it on a valid target or it will move back to where it started and you can't drag from one list to the other.

The Code

Docs available here - Full source here - Minimized source here

Test List #1

  • Test 1
  • Test 2
    • Test 2-1
    • Test 2-2
    • Test 2-3
    • Test 2-4
  • Test 3
    • Test 3-1
    • Test 3-2
    • Test 3-3
    • Test 3-4
  • Test 4

Test List #3 (divs)

Content here #1
Content here #2
Content here #3
Content here #4
Content here #5

Test List #2

  • Test 1
  • Test 2
    • Test 2-1
    • Test 2-2
    • Test 2-3
    • Test 2-4
  • Test 3
    • Test 3-1
    • Test 3-2
    • Test 3-3
    • Test 3-4
  • Test 4