Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#14901 closed enhancement (fixed)

DnD Container only supports dnd item nodes that direct descendants of the container node

Reported by: Kris Zyp Owned by: Eugene Lazutkin
Priority: undecided Milestone: 1.8
Component: DnD Version: 1.7.2
Keywords: Cc:
Blocked By: Blocking:

Description

DnD Container only supports dnd item nodes that direct descendants of the container node:

https://github.com/dojo/dojo/blob/master/dnd/Container.js#L368

It is unclear why this restriction is in place. Can we allow for dnd item nodes to be nested inside other elements in a container (by removing the parent == this.parent check)?

Attachments (1)

nestable-dnd.diff (2.8 KB) - added by Kris Zyp 8 years ago.
Patch to allow nested elements

Download all attachments as: .zip

Change History (8)

comment:1 Changed 8 years ago by bill

Presumably it's because that would require a lot more code. All the logic for dropping nodes (dropping node X between A and B) would have to be enhanced to detect when you were dropping one node inside another node, etc. Tree does this.

Changed 8 years ago by Kris Zyp

Attachment: nestable-dnd.diff added

Patch to allow nested elements

comment:2 Changed 8 years ago by Kris Zyp

I attached a patch. Would that work? It seems to work properly in the test.

comment:3 Changed 8 years ago by ben hockey

about 3 years ago i was working on a customized version of the grid that was supposed to support dnd. i remember trying some ugly hacks to see if i could make it work. fortunately, i have managed to purge most of the details from my memory, but i seem to remember that the nodes for each row were nested descendants (rather than direct descendants) of the most logical node to make the dnd container and something like this patch would have probably reduced some of the hacking. so, i'm interested in seeing what the outcome is for this ticket.

comment:4 Changed 8 years ago by bill

Oh I misunderstood, I thought you wanted one dndItem to contain another, rather than just having various wrapper divs within the dojo.dnd.Source. FWIW your patch is working for me.

comment:5 Changed 8 years ago by Kenneth G. Franqueiro

This patch blows up in IE because parentElement is not a thing there. Is there an alternative (or a reason it's not just using parentNode)?

comment:6 Changed 8 years ago by Kris Zyp

Resolution: fixed
Status: newclosed

In [28150]:

Allow nested elements in drag n' drop containers, fixes #14901 !strict

comment:7 Changed 8 years ago by bill

Milestone: tbd1.8
Note: See TracTickets for help on using tickets.