0

I'm building a drag-and-drop outline tool. It uses jQueryUI's .sortable() in a nested fasion to build a tree of elements. I also have a palette of items using .draggable() that can be dragged into the outline at any given level.

Dropping a new item into the topmost level of the tree works fine. But when I drop one into the 2nd level down, the item gets duplicated. When I drop one into the 3rd level, the item gets duplicated twice! I've boiled the problem down to its essence here: http://jsfiddle.net/curtisfarnham/TGAqW/

How can I prevent items from getting duplicated when dropped into the lower levels of the tree?

1 Answer 1

1

This is a bug in jquery ui 1.8 serie, event bubbling.

See updated jsFiddle using jquery ui 1.9.1

<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script>

http://jsfiddle.net/TGAqW/3/

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks!!! I'd seen 1.9.1 was out, but I read about the breaking changes and I wasn't sure I wanted to deal with a compatibility layer. Looks like I'll have to delve into it after all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.