I use dhtmlxTreeGrid to display a hierarchy of items. I want the user to be able to change the hierarchy by drag-and-drop within the TreeGrid. Because I want to allow multiple root nodes in the hierarchy, it should also be possible for the user to make former subnodes to root nodes just by dropping them BETWEEN other root nodes (using setDragBehavior = complex; i.e., the former subnodes become siblings of already existing root nodes).
When updating the underlying database entries, I need to discriminate between nodes being droped as siblings (i.e. BETWEEN target nodes) or as children (i.e. ONTO a target node). I am using an event handler for the onDrop event, which nicely gives me the id of the node being droped as well as that of the target node. But: how can I find out wheter the node has been dropped ONTO a target node (i.e., as a child) or BETWEEN target nodes (i.e., as a sibling)?
You can poll dragContext object for more details, which available during onDrop event
grid.attachEvent(“onDrop”,function(sid,tid){
alert("type "+grid.dragContext.dropmode); // it may be a “sibling” or “child”
});