angular-ui / ui-sortable

jQuery UI Sortable for AngularJS
http://angular-ui.github.io/ui-sortable/
MIT License
1.26k stars 444 forks source link

Moved Item are placed before targeted item in certain cases #17

Closed t00f closed 11 years ago

t00f commented 11 years ago

Hi guys,

I am facing a very wired behavior when I try to move an item from the top to the bottom. If you switch an item with its direct neighbor, it works fine. But when you move this item for more than 1 step, it is placed before the targeted item.

To be more precise, I write a small JSFiddle here : http://jsfiddle.net/vf8nC/

Moving "var5" between "var1" and "var2" works fine. Moving "var2" between "var5" and "var6" moves "var2" between "var4" and "var5"

I also go through these steps

Moving "var3" after "var4" works fine Moving "var4" back before "var3" does not change "var3" and "var4" position at first. Retry it and it will move properly.

I added a specific style to use scrolling but you can remove it and face the same strange things.

Do you have any idea about what could it be ?

Thanks a lot !

t00f

johnparn commented 11 years ago

I added the latest ui-sortable code from Github to the example and it seems to work. Give it a try. http://jsfiddle.net/johnparn/v8Y93/1/ (this is the correct link)

I believe I had the same problem with the all in one release of angularui version 0.4.0 version and had to fix the code in the ui-sortable directive. As the code is now broken up to separate parts I would suggest you try the separate ui-sortable: https://github.com/angular-ui/ui-sortable/tree/master/src

t00f commented 11 years ago

Hi johnparn,

Thanks a lot, it works just fine ! ;-)