I have a tree in a dhtmlx window with dragdrop behaviour set to sibling. Somehow I am not able to drag and drop the sibling above topmost item. Though I can drag topmost most item down. Here is sample code:
tree.setDragBehavior(“sibling”);
tree.enableHighlighting(true);
tree.insertNewChild(0,“id1”,“item1”);
tree.insertNewNext(“id1”,“id2”,“item2”);
tree.insertNewNext(“id2”,“id3”,“item3”);
The “sibling” mode allows to drop item below other, but not above. You may use “complex” mode , which allows both behaviors.
“sibling” mode does allow item to drop above other except the top one. I tried ‘complex’ mode and it does let me drag to the top but it also lets item to be child of another which I don’t need. I need the sibling behavior in terms of relationship between items.
Thanks
above other except the top one
While it may look as above, in-grid logic treates it as “below the next item”, this is limitation of used approach , which can’t be changed easily.
>> but it also lets item to be child of another which I don’t need.
While it may be not the best solution, the next code used with “complex” drag behavior, will block any attempt to drop as child.
tree.attachEvent(“onDrag”,function(sid,tid,bid){
if (!bid) return false;
return true;
})
Thanks, that solution with ‘complex’ to block drop as child works good but now items can not be dropped to the bottom most.
Yep, I missed this point.
The next code works correctly for both top and bottom positions
tree.attachEvent(“onDrag”,function(sid,tid,bid){
if (!this.dadmodec) return false;
return true;
})
Working sample sent by email.