Drag + drop into a top-level folder?

I have been playing around with the drag + drop functionality, and it seems like the new versions don’t allow you to drop an item into a top-level folder as a child? Only as a sibling? Is there a way to enable that somehow?

drag + drop behavior is set to “child” but when I try and drop into the top most folder, it turns off child mode, puts in a yellow splash screen, and appends the element as a sibling

Hello
We need your demo to reproduce the issue. Please, do not attach here pro js files if you use it.

To reproduce the issue, on the pro demo page on the “drop as child” tree move a node to the top-left corner. In our case, the topmost folder cannot be selected as the drop target. Instead we only get the yellow screen.

dhtmlx.com/docs/products/dhtmlxT … bling.html

We are currently getting around this in the following way:

var tree = new dhtmlXTreeObject(‘tree’,‘100%’,‘100%’,0);
tree.enableSmartXMLParsing(true);
tree.loadXMLString(myxml);
tree.enableDragAndDrop(true);
tree.enableDragAndDropScrolling(true);
tree.setDragBehavior(“child”);

tree.attachEvent(‘onDrag’, function(sourceid,targetid,id,sobject,tobject) {
// if the targetid is “0”, or splash screen, then change the target to a valid
// node the user is trying to drop the item into
if(targetid == 0) {
// the moveItem function fires the onDrag event again, this
// time with the correct targetid
tobject.moveItem(sourceid,‘item_child’,theidoftheintendedtarget);
// cancel this event
return false;
}
}

we are dealing with a single tree instance in this case

Hello,

drag + drop behavior is set to “child” but when I try and drop into the top most folder, it turns off child mode, puts in a yellow splash screen, and appends the element as a sibling

If you drag and drop “Dan Brown” node into “Books” node, “Dan Brown” becomes a child of “Books”. If you drag-n-drop a node into top-left corner, the node is dropped as top folder. It correct behavior.

if you want to drop into “Books” folder in both cases you can use the following code snippet:

tree.attachEvent('onDrag', function(sourceid,targetid,id,sobject,tobject) { if(targetId == 0) { tobject.moveItem(sourceid,'item_child',this.getChildItemIdByIndex(0,0)); return false; } return true; });