Drag & drop with multi selected items

365 views
Skip to first unread message

Aurélien

unread,
Aug 18, 2011, 8:58:44 AM8/18/11
to Discuss jquery.dynatree.js
Hello.
With Dynatree, is it possible to drag and drop more than one item
simultaneously ?
Thanks a lot

mar10

unread,
Aug 21, 2011, 3:06:20 PM8/21/11
to dyna...@googlegroups.com
Hi,

I think that is possible, though I haven't tried yet.

The current samples and default implementations assume, that you are dragging the `active` node.

If you want to move a number of `selected` nodes instead, you could simply modify the `onDrop(targetNode, sourceNode, hitMode)` handler:
`sourceNode.tree` will give you the source tree.
Then you can use the API (for example `sourceNode.tree.getSelectedNodes()`, `node.addChild()`, or `node.remove()`) inorder to implement copy/move behavior.

The copy/paste example may give an idea, although the task is slightly different there:
   http://wwwendt.de/tech/dynatree/doc/sample-contextmenu.html

Maybe there should also be a way to modify the helper image that is displayed while dragging, but i am not even sure how it should look like,

Hope that helps
Martin

Reply all
Reply to author
Forward
0 new messages