tags:

views:

97

answers:

2

I have two divs nested under a parent div and I want all these to be source as well as targets for dojo.dnd.

I want to be able to add nodes to the div over which the content was dropped and also allow the user to move this in between the 3 divs.

Something like this - http://www.upscale.utoronto.ca/test/dojo/tests/dnd/test_nested_drop_targets.html

This is I gues implemented in older version of Dojo and doesn' seem to work with 1.4

Is the support for nested targets removed? Is there any way to achieve this?

+1  A: 

Nested sources/targets are not supported currently. In most cases you can work around this restriction by using independent sources/targets, yet positioning them as you wish with CSS.

Eugene Lazutkin
I am trying to build a DnD visual editor for Dojo widgets. So people can visually compose the UI. So just placing them visually won't work :(I want to be able to drag components between divs, move divs in and out of divs, etc.Any way we can achieve this. I am comfortable writing a custom DnD handler or using the DnD topics. Just want the right direction to look in!
Rohit
Eugene Lazutkin
A: 

I used a workaround for this case. I create another DIV element which positioned at the same place of the nested target with same width and height but with higher z-Index value. Then the new DIV element covers the nested target. When user is trying to drop on the nested target, he actually drops to the above new DIV element. As long as the new DIV element is not nested in the parent drop target, Dojo's dnd operation works well. I usually put the new DIV element as a child of the body element.

What you need to do is to create the new DIV in onDndStart and destroy it in onDndCancel, then everything should work well.

Alex Cheng