TreeGrid complex DnD - drop as child or sibling

using TreeGrid with complex DnD enabled, i’d need an approach to distinguish wether an element was dropped as child or as sibling.

as mentioned in docs dhtmlx.com/docs/products/doc … ndex.shtml

the onDrag Event unfortunately does not provide such information to registered handler functions.





g = new dhtmlXGridObject(“outline”);

g.enableDragAndDrop(true);

g.setDragBehavior(“complex”);

g.setHeader(“Outline”);

g.setInitWidths(“400”)

g.setColAlign(“left”)

g.setColTypes(“tree,ch”);

g.init();



function dndHandler(draggedID, targetID, sourceObj, targetObj, dragCol, dropCol){

alert( “dndHandler(”+draggedID+", “+targetID+”, “+sourceObj+”, “+targetObj+”, “+dragCol+”, “+dropCol+”)…" );



// that’s where i’d need to know if node was dropped as child, or as sibling

var dragged = targetObj._dragged[0]; // maybe i could compare some attributes of child/parent elements of surrounding rows like

// get the previous sibling’s child list

// check if dragged one is part of them



return true;

}

g.attachEvent(“onDrag”,dndHandler);





i’d greatly appreciate any help

You can get mode in onDrag event handler as follows:

function dndHandler(draggedID, targetID, sourceObj, targetObj, dragCol, dropCol){


var mode = g.dragContext.mode;
return true
}
g.attachEvent(“onDrag”,dndHandler);