Categories | Question details Back To List | ||
How to setting Tree's itemid at drop time ? I have 2 trees: source & target tree Source tree’s structure like this: Level1:Area-A Level2: Customer-1 (id:01) Level2: Customer-5 (id:05) Level2: Customer-7 (id:07) Target tree’s structure like this: Level1:Department-A Level2: Employee-1 (id:15) Level3: Customer-1 (id:15_01) Level3: Customer-7 (id:15_07) Level2: Employee-2 (id:18) Level3: Customer-1 (id:18_01) Level3: Customer-5 (id:18_05) Level3: Customer-7 (id:18_07) my requirements: when drag source tree’s leaf (ex. Customer-5) and drop to target tree’s level 2 (ex. Employee-1), need do check (id:15_05) exist or not. If drag to Employee-2, do check (id:18_05) exist or not 1. if exist : cancel this action 2. if not exist, action successful, and tree-id need setting as above 3. if “enableMultiselection” set to true, how to resolve at this situation? Thanks a Lot !! Answer posted by Alex (support) on Jun 10, 2009 08:50 You can try to use onDrag event handler. It allows to block drag-n-drop and gets ids of source and target items as arguments. The example of the onDrag handler for the target tree: employeeTree.attachEvent("onDrag",function(sid,tid){ Answer posted on Jun 10, 2009 22:25 my code: dhxTree.attachEvent("onDrag",function(sid,tid){ if (list.length == 0)
Target tree’s structure like this: 1. drag “Customer-A”, drop “Customer-A”, action cancel, ok
seems index have some problems !! use dhtmlxTree v.2.0 Professional edition build 81009/81107 Answer posted by Alex (support) on Jun 11, 2009 01:42 Hello, this is a correct behavior as ids in source and target trees are the same. For example: You drag item with 13-1 from source tree to target, but target already has Customer-B item with id=13-1. So, when you call changeItemId("13-1","13-11_13-1"), the id changes for Customer-B item that is in Type-B branch. Please, use different ids for tree2 - and the issue will be solved
|