views:

465

answers:

2

After I move (sort) one of my list items I would like to know which position it just got dropped into. I'm pretty sure this is impossible to calculate off of ui.position/offset since I have been able to drop onto the same pixel and have the item go in two different slots, depending on which direction I dragged the element from.

I suppose I can do some traversing and counting after the object is dropped but I was hoping that there was some direct way of getting this piece of info.

Thanks

A: 

I wrote an article for smashing magazine that gets the order of li's for sending through to a backend. You might find the drag and drop/jquery parts of the tutorial useful.

Steerpike
+1  A: 

This gets what I need.

ui.item.prevAll().length + 1

crankharder