So i have a nested jqueryui sortable and a draggable item that i can drag a copy into any level sortable.
See jsfiddle here http://jsfiddle.net/rmossuk/JUnA7/4/
- Product
-
- Item1
-
- Item2
-
- Item3
-
-
- Item5
-
-
-
- Item6
-
-
- Item4
NewItem
The problem is when i drag the NewItem into the nested sortable ( Item3 ) the receive event gets called 3 times. Once for the product sortable and for some reason twice for the Item3 sortable !!??
I need it so that just the Item3 sortable receive event gets called and not the other 2.
Does anyone know how to do this please??
thanks a lot
The error is a result of having a div.sortable nested in another div.sortable, so it it fires the sorting twice when you drop in a new element. The workaround I came up with just counts the number of elements added in a particular drop and adds a class called ‘deleteMe’ to the duplicates.
Then you just call $(“.deleteMe”).remove() at the end of a sort to remove the extras.
Not ideal, but seems to work for me. http://jsfiddle.net/JUnA7/72/
UPDATED
Also, I noticed that the sorting placeholders a duplicated too..so I removed the duplicates by setting their height to 0px.