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/