Categories | Question details Back To List | ||
DHTMLXTree:Problem on onDragInEvent and node close while initialing Hello, I have 2 problems on the DHTMLXTree. 1. Could you please tell me how to check if the user is dragging in sibling mode? I want to do something while user is dragging a node in sibling mode, so I use onDragIn event, but can you tell me how to check if the user is dragging in sibling mode? 2. Could you please tell me how to only open the level 3 nodes after the tree is initialed? I have a lot of levels in my tree, I need it only open the level 3 nodes and all nodes under level 3 is closed after the tree is initialed. Waiting for your reply. Thanks very much. Answer posted by Alex (support) on Oct 26, 2009 08:46 Hello, do you complex drag mode ? If you do, try to use the following approach: tree.attachEvent("onDragIn",function(sid,tid){ To open a certain number of levels you can use getSubItems method to get child items from the next level. You can iterate through necessary items by this method. The openItem method can be used for opening Answer posted by jecoso on Oct 27, 2009 05:44 Hi, Alex Thanks very much for your kind reply. Your code is very helpfull, but I still complete the need from the client, could you give me some advise? We have a tree like this: |- Root The need is : My problem point is how to limit the nodes can be dragged into upper level, can be ordered, but can not be dragged into other nodes in complex drag mode. Thanks in advance. Answer posted by Alex (support) on Oct 27, 2009 07:03 Hello, the onDrag event allows to block dropping. The drag-n-drop is denied if onDrag event doesn't return true. The event gets source and target item ids as arguments. You can use getLevel method for check target item level: tree.attachEvent("onDrag",function(sid,tid){ Answer posted by Jecoso on Oct 27, 2009 19:11 Hi, Alex Thanks for your kind reply. But if I use your codes: tree.attachEvent("onDrag",function(sid,tid){ Nodes in level 3 can not be dragged in sibling mode. Is there any other idea? Thanks in advance. Answer posted by Alex (support) on Oct 28, 2009 03:35 Hello, possibly the level should less than 4: return (this.getLevel(tid)<4); tid always returns parent item id. |