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
100
Moving Nodes Between WebDataTree's
posted

I'm currently working on a application that uses the WebDataTree to display groups as nodes that have child nodes.  My goal is to be able to move the parent nodes from one tree to another and vice versa.  I'm running into an issue where after a node is moved around several times the node basically goes blank.  Essentially I am moving one DataTreeNode object from one tree to another then back again.  I have attached screen shots to show what is happening.

Before:

 

After:

 

I am not exactly sure what is causing the node to render empty.  I am moving the nodes on the server side and am using full post backs.

Here's a code snippet:

Add:

 

    Protected Sub btnAdd_Click(ByVal sender As ObjectByVal e As System.EventArgsHandles btnAdd.Click
        ' Make sure we have a valid WG selected
        If wdtAllWg.SelectedNodes.Count > 0 Then
            ' Get selected nodes to add
            For Each wgNode As DataTreeNode In wdtAllWg.SelectedNodes
                ' Reset node and add to trees
                With wgNode
                    .Selected = False
                    .Expanded = False
                End With
                wdtEmpWg.Nodes.Add(wgNode)
                wdtCopyEmpWG.Nodes.Add(wgNode)

                ' Remove the node from the Dept WG's tree
                wdtAllWg.Nodes.Remove(wgNode)
            Next
        End If
    End Sub

Remove:

    Protected Sub btnRemove_Click(ByVal sender As ObjectByVal e As System.EventArgsHandles btnRemove.Click
        ' Make sure we have nodes selected to remove
        If wdtEmpWg.SelectedNodes.Count > 0 Then
            For Each wgNode As DataTreeNode In wdtEmpWg.SelectedNodes
                ' Collapse the node and remove it from emp WG trees
                With wgNode
                    .Selected = False
                    .Expanded = False
                End With

                ' Add WG back to the Dept WG tree
                wdtAllWg.Nodes.Add(wgNode)

                ' Remove the WG from the emp WG trees
                wdtEmpWg.Nodes.Remove(wgNode)
                wdtCopyEmpWG.Nodes.Remove(wgNode)
            Next
        End If
    End Sub

I'm wondering is something is getting thrown off when moving the DataTreeNode from one tree to another. I am at a loss right now though.

 

  • 6748
    Suggested Answer
    posted

    Hello Randy,

     

    I created a support ticket on your behalf and linked it to the development issue in order to be notified when the service release with the fix is launched.

     

    Regards,

    Lyuba

    Developer Support Engineer

    Infragistics

    www.infragistics.com/support

     

  • 3726
    Suggested Answer
    posted

    Hi,

    when moving nodes between trees it is not required to do anything on the server side. Each tree has an event log on the client side which registers the node drops. When you do a postback this event log is executed on the server and modifies the Nodes collections and even moves the nodes between the trees on the page. Also I know there is an issue if you have configured NodeDropped auto postback flag to Async, which is causing such empty nodes to be shown - this will be fixed soon.

    Thanks,

    Lubomir