Can we have nested objects in Dojo?

I have two divs nested in the parent div, and I want all of them to be the source, as well as the goals for dojo.dnd.

I want to be able to add nodes to the div over which the content has been removed, and also allow the user to move it between the three divs.

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

I use this in the old version of Dojo and does not work with 1.4

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

+3
source share
3 answers

/ . , /, CSS.

+1

. DIV, , z-Index. DIV . , DIV. DIV , Dojo dnd . DIV body.

, DIV onDndStart onDndCancel, .

+1

Dojo 1.10 - Dnd.

CSS div . , dndContainer dndContainer onMouseOverEvent .

- dojo , :

dndSource, . nestedDndSource.js

define([
    "dojo/_base/declare",
    "dojo/dnd/Source",
    "dojo/dnd/Manager"
], function(declare,dndSource, Manager){

    var Source = declare("dojo.dnd.Source", dndSource, {
        parentSource: null,
        onOutEvent: function(){
            if(this.parentSource != undefined)
                Manager.manager().overSource(this.parentSource)
            Source.superclass.onOutEvent.call(this);
        }
    });

    return Source;
})

nestedDndSource dojos dndSource parentSource-Parameter:

var parentDndSource = new dojoDndSource(parentNode, {..});
var childDnDSource = new nestedDndSource(childNode,{
                        parentSource: parentDndSource,
                        onDropExternal: ...
                     });

: https://jsfiddle.net/teano87/s4pe2jjz/1/

0

Source: https://habr.com/ru/post/1728767/


All Articles