Limiting Number of Tree Levels

Hi - I have a dhtmlxTree on a webpage. It has a root node by default. I have a drop drown and button on the page. User can select an item from the dropdown, and then click the button to add the item from the dropdown to the tree (under the root).

The tree should only have one level of items beneath the root. In other words, all items added to the tree should be siblings beneath the root node.

Once items start to accumulate under the root, users can use drag-and-drop to reorder the nodes. The problem is that currently the user can drag-and-drop to place sibling nodes underneath one another, creating a multi-level tree. Is there a way to prevent this while still allowing users to add items to the tree and reorder the nodes? I have not been able to find an example or posting on this.



you can use setDragBehavior(“sibling”) instead of default “child” (this mode is available only in PRO edition).