Categories | Question details Back To List | ||
tree unable to drag drop sibling item at the highest level 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"); Answer posted by Support on Sep 29, 2008 16:40 The "sibling" mode allows to drop item below other, but not above. You may use "complex" mode , which allows both behaviors. Answer posted on Sep 30, 2008 07:07 "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 Answer posted by Support on Sep 30, 2008 08:17 >>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; }) Answer posted by Sanjay on Sep 30, 2008 10:16 Thanks, that solution with 'complex' to block drop as child works good but now items can not be dropped to the bottom most. Answer posted by Support on Oct 01, 2008 05:57 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. |