Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
170
UltraWebTree Drag and Drop Node with Children onto a second UltraWebTree
posted

Hi,

My Version: 2008 vol 1 for CLR 3.5

When I try to drag and drop a Node that has children from one WebTree to another, only the current node is dropped on the target.  Any child node on the source node is not dropped on the target.  I have checked your sample which also behaves the same way.  Does that mean I cannot move or copy a Node alongwith it's children?  That doesn't sound right.  If I need to change the javascript function to achieve that, could you please show me a sample script that can do it?  I am not a guru on java script.

Thanks.

Parents
  • 504
    posted

    I have no idea how you are dropping from one tree to another, but i guess you have to loop thjrough the children of the dragged node and then add this to another tree.

     

    Please try this

    function AddChildNodesRecursive(childNode, parentNode)
        {
            var newChild = parentNode.addChild(childNode.getText());
            if (childNode.hasChildren())
            {
                var children = childNode.getChildNodes();
                for (c in children)
                {
                    var childSubNode = children[ c ];
                    AddChildNodesRecursive(childSubNode, newChild);
                }
            }
        }

Reply Children