curtisdf
curtisdf

Reputation: 4210

Nested sortables as drag targets

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?

Upvotes: 0

Views: 277

Answers (1)

A. Wolff
A. Wolff

Reputation: 74410

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/

Upvotes: 1

Related Questions