Login Register

dnd source into a dnd source

Hi all,

Here's my problem, i want to move item from a group (of item) to another group (that's work fine ;)) but I want also move group to order them.

This is what i do :

<div accept="C" class="container" dojotype="dojo.dnd.Source" jsid="root">

<div class="dojoDndItem" dndtype="C"><h3>Group 1</h3><div accept="S" class="container" dojotype="dojo.dnd.Source" jsid="c1">
<div class="dojoDndItem" dndtype="S">Item <strong>Item 1-1</strong></div>
<div class="dojoDndItem" dndtype="S">Item <strong>Item 1-2</strong></div>
<div class="dojoDndItem" dndtype="S">Item <strong>Item 1-3</strong></div>
</div></div>
 
<div class="dojoDndItem" dndtype="C"><h3>Group 2</h3><div accept="S" class="container" dojotype="dojo.dnd.Source" jsid="c2">
<div class="dojoDndItem" dndtype="S">Item <strong>Item 2-1</strong></div>
<div class="dojoDndItem" dndtype="S">Item <strong>Item 2-2</strong></div>
<div class="dojoDndItem" dndtype="S">Item <strong>Item 2-3</strong></div>
</div></div>
     
<div class="dojoDndItem" dndtype="C"><h3>Group 3</h3><div accept="S" class="container" dojotype="dojo.dnd.Source" jsid="c3">
<div class="dojoDndItem" dndtype="S">Item <strong>Item 3-1</strong></div>
<div class="dojoDndItem" dndtype="S">Item <strong>Item 3-2</strong></div>
<div class="dojoDndItem" dndtype="S">Item <strong>Item 3-3</strong></div>
</div></div>

<div class="dojoDndItem" dndtype="C"><h3>Group 4</h3><div accept="S" class="container" dojotype="dojo.dnd.Source" jsid="c4">
<div class="dojoDndItem" dndtype="S">Item <strong>Item 4-1</strong></div>
<div class="dojoDndItem" dndtype="S">Item <strong>Item 4-2</strong></div>
<div class="dojoDndItem" dndtype="S">Item <strong>Item 4-3</strong></div>
</div></div>

</div>

but it doesn't work :(
can you help me please ?

The plain vanilla DnD

The plain vanilla DnD supports lists of DnD items, not lists of lists. If you want the latter, look at the Tree widget --- it supports hierarchical structures you want. Alternatively you can try to take a look at this ticket: http://trac.dojotoolkit.org/ticket/5859. If you try it, please let me know if it works for you as you want. You can post it in the ticket itself logging in as guest/guest.

i try it

i try the patch, i can move each group to order them
but i have an error when i move items inside group to order them or to change group :

t has no properties
[Break on this error] return {node: node, data: t.data, type: t.type};

Nested Dnd Sources

to fix this problem, you only need to add piece of code listed below in Sources.js fils

enjoy

onDndDrop: function(source, nodes, copy)
{
if (dojo.dnd.manager().target != this)
{
this.onDndCancel();
return;
}
...
}