This is a migrated thread and some comments may be shown as answers.

Node Deep Move.

3 Answers 88 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ben Turpin
Top achievements
Rank 1
Ben Turpin asked on 04 Jul 2008, 07:07 PM
Hello.

I checked the drag drop example demo and the code does a "deep copy" of the nodes, meaning that it moves the node and every child in it.

destinationNode.get_nodes().add(sourceNode); 

My code:
function ProcessBookOperations (sourceNode, destNode, dropPosition) 
    var sourceType = GetNodeType(sourceNode); 
    var destType = GetNodeType(destNode); 
     
    if (sourceType == "mi" && destType == "me"
    { 
 
       destNode.get_nodes().add(sourceNode) 
       destNode.set_expanded(true); 
    } 
     

It moves the node but not its childs, actually I just noticed that is does move the node with the childs but the '+' symbol does not appear. If I get another node and hold it on top of it, it automactly Loads on demand then expands the node showing the childs. How can I solve this?


Btw, is there any way to remove this expand '+' symbol
programmatically, even if it has any childs in it?

Thanks!

3 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 07 Jul 2008, 11:52 AM
Hi Ben Turpin,

I have just tried drag and drop of a Node with children to another not expanded Node and everything worked normally - the destination Node expanded properly and the moved Node had its plus-sign.

Maybe there is something else which I am missing which is valid in your case. Could you give me more details about your TreeView configuration, like what ExpandMode do your Nodes have for example?

As for hiding the 'plus'-sign, you can use the following CSS to do it:

div.RadTreeView .rtPlus 
displaynone
div.RadTreeView .rtTop, 
div.RadTreeView .rtMid, 
div.RadTreeView .rtBot 
padding: 0; 

Best wishes,
Simon
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ben Turpin
Top achievements
Rank 1
answered on 07 Jul 2008, 07:07 PM
Hi, thanks for the reply.

My tree has some clientSide and ServerSideCallback expand nodes. It depends if the node has a child or not.

Here is the code:
<telerik:RadTreeView   
        ID="BookTreeView"   
        Runat="server" 
        CssClass="treeContainer" 
        LoadingStatusPosition="BeforeNodeText"   
        EnableDragAndDrop="True"   
        EnableDragAndDropBetweenNodes="True"   
        AllowNodeEditing="True"   
          
        onnodeexpand="BookTreeView_NodeExpand" 
          
        onclientnodedropping="onNodeDropping"   
        onclientnodeediting="onClientEditing" 
        EnableViewState="False" P
        ersistLoadOnDemandNodes
="False" 
          
        > 
          
          
        <CollapseAnimation Type="OutQuint" Duration="10"></CollapseAnimation> 
 
        <ExpandAnimation Type="OutQuart" Duration="10"></ExpandAnimation> 
    </telerik:RadTreeView> 


    private void LoadTreeRootNodes(RadTreeView treeView, IEnumerable<Node> nodes, string imagePath, string itemType)  
    {  
        foreach (Node node in nodes)  
        {  
            RadTreeNode tempNode = new RadTreeNode();  
 
            tempNode.Text = node.Text;  
            tempNode.Value = itemType + node.Id;  
 
            tempNode.ImageUrl = imagePath;  
 
            tempNode.ExpandMode = (node.HasChilds) ? TreeNodeExpandMode.ServerSideCallBack : TreeNodeExpandMode.ClientSide;  
 
            treeView.Nodes.Add(tempNode);  
        }  
    } 

    private void AddChildsToNode(RadTreeNode fatherNode, IEnumerable<Node> childNodes, string imagePath, string menuType)  
    {  
        foreach (Node node in childNodes)  
        {  
            RadTreeNode tempNode = new RadTreeNode();  
 
            tempNode.Text = node.Text;  
            tempNode.Value = menuType + node.Id;  
            tempNode.ImageUrl = imagePath;  
 
            fatherNode.Nodes.Add(tempNode);  
        }  
    } 

Another little question:
How do you remove a root node that has no father?
As you can see my tree has no start root node and when I try to remove  a node like this:
 destNode.get_nodes().add(sourceNode)

this error rises from VS javascript debugger:
Htmlfile: Invalid Argument
and highlights this line:
_9b.get_childListElement().removeChild(this.get_element());

Any chance what that might be?

Thanks!

0
Simon
Telerik team
answered on 10 Jul 2008, 02:30 PM
Hello Ben Turpin,

I tried once again to reproduce the issue: drop on a Node with ClientSide ExpandMode and on another with ServerSideCallBack - everything worked normally.

I suggest you prepare a simple project, attach it a support ticket and send it to me (just refer to this forum thread). In this way I will be able to investigate the problem directly and hopefully will provide a solution.

I will also post the results here, so that others can seen them as well.

Kind regards,
Simon
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
TreeView
Asked by
Ben Turpin
Top achievements
Rank 1
Answers by
Simon
Telerik team
Ben Turpin
Top achievements
Rank 1
Share this question
or