Created
March 28, 2013 13:12
-
-
Save moromete/5263027 to your computer and use it in GitHub Desktop.
By overriding _getChildByEvent method of dojo/dnd/Container we can enable dnd of any row also on another level of the tree not just first level
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(["dojo/_base/lang", 'dojo/dnd/Container', 'dojo/dom-class'], function(lang, Container, domClass) { | |
lang.extend(Container, { | |
_getChildByEvent: function(e) { | |
var node = e.target; | |
if(node){ | |
/* | |
for(var parent = node.parentNode; parent; node = parent, parent = node.parentNode){ | |
if((parent == this.parent || this.allowNested) && domClass.contains(node, "dojoDndItem")){ return node; } | |
} | |
*/ | |
var node_found; | |
for(var parent = node.parentNode; parent; node = parent, parent = node.parentNode){ | |
if(domClass.contains(node, "dojoDndItem")) { | |
node_found = node; | |
} | |
if((parent == this.parent || this.allowNested) && (typeof(node_found)!='undefined')) { | |
return node_found; | |
} | |
} | |
} | |
return null; | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment