Categories | Question details Back To List | ||
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 http://www.dhtmlx.com/docs/products/docsExplorer/index.shtml the onDrag Event unfortunately does not provide such information to registered handler functions. <code> 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); </code> i'd greatly appreciate any help Answer posted by Support on Nov 10, 2008 08:49 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); |