Complex DnD Mode Differentiation in "onDragIn"

Hello,

We are currently using the enterprise version of DHTMLX version 4.6.

In the “onDragIn” event I would like some way to differentiate when I am about to drop in sibling mode versus child mode (using the “complex” drag mode). My goal is to disable the ability to drag into certain nodes while still providing the option to drop as a sibling of that node. In the “onDrag” event there is a parameter “id” which indicates if a node was dropped as a sibling. If we could have a similar parameter in the “onDragIn” event it would allow me to differentiate between “sibling” and “child” drop locations for the same target node. Or really any way to differentiate where I am dragging so that I can return true or false accordingly would be appreciated.

I found some code in the forum that is designed to determine whether the user is dragging in to sibling mode:
tree.attachEvent(“onDragIn”,function(sid,tid){
window.setTimeout(function(){
if(tree.selectionBar.style.display!=“none”) {/your code for sibling drag/}
},1)
return true
})
Although this method allows me to determine if it’s being dragged in sibling mode, it appears that returning true or false inside of the “timeout” function doesn’t disable that node (it still become highlighted), seemingly from the 1ms delay.

Is there any way to accomplish my goal here?

Thank you!

Hello,

You may try to change drag mode depending on target id:

function isBlocked(id){
    // your code  
}

tree.attachEvent("onDragIn", function(sid,tid){
    if(isBlocked(tid))
	tree.setDragBehavior("sibling");
    else
	tree.setDragBehavior("complex");
    return true;
});