Kind'a拍摄一张空白我想,还有dndSource几个不同的实现。但是有一些事情需要了解在mouseover/dnddrop期间调用的事件/ checkfunctions。
一种方法是设置为checkAcceptance(source, nodes)
如果您有任何目标。然后保留当前拖动的节点的引用。获取棘手,虽然有多个容器具有动态内容。
设置你的源代码,而重写checkAcceptance
和使用已知的,(也许是全球)变量跟踪。
var lastReference = null;
var target = dojo.dnd.Source(node, {
checkAcceptance(source, nodes) : function() {
// this is called when 'nodes' are attempted dropped - on mouseover
lastReference = source.getItem(nodes[0].id)
// returning boolean here will either green-light or deny your drop
// use fallback (default) behavior like so:
return this.inhertied(arguments);
}
});
最好的办法可能就是这样的 - 你得到两个目标和源加上手头的节点,但是你需要找出哪些是看在节点右边堆我相信它在出版同时作为事件(onDrop
)您选择使用媒体链接:
dojo.subscribe("/dnd/drop", function(source, nodes, copy, target) {
// figure out your source container id and target dropzone id
// do stuff with nodes
var itemId = nodes[0].id
}
可用机械/主题通过dojo.subscribe和活动在此列出 http://dojotoolkit.org/reference-guide/1.7/dojo/dnd.html#manager
感谢您的回复。我很感激帮助。 我不知道你的意思是“dndSource有几个不同的实现”......你能澄清一下吗?我正在使用Source.js中的一个。 .subscribe技术与我的问题中描述的问题相同。如果我的订阅在内置之后被调用,则该项目已从源代码中删除。我不希望我的程序依赖于回调的顺序。 – Harold 2012-07-11 18:06:27
有一个特定于dijit.Tree的dnd api,这些dojox中的一些..它是dojo/dnd/Source吗?无论哪种方式,实现一个dndSource.checkAcceptance(源,节点)然后 - 我填写空白 – mschr 2012-07-12 21:53:26
哦,没有注意到你的答案如下:p – mschr 2012-07-12 22:02:07