How do I Expand All the nodes?

Posted by: ajaysingal on 8 September 2017, 12:42 pm EST

  • Posted 8 September 2017, 12:42 pm EST

    I am using spread to display data in a hierarchy.  Starting from the parent node, my child nodes can be upto 5 levels deep.  Initially, when the form loads, I would like to display all parents/children in expanded form.  How can I do that?


    I am aware of ExpandRow method.  I have tried calling ExpandRow method for each parent record.  As a result, all the parent records (top level) are expanded.  Now, each parent has child(ren) and each child has child, ... and so on upto 5 levels deep.  How do I expand the children?


    I have created a test project and will be happy to share it with you (if needed). 


    Any help will be greatly appreciated. 


    Thanks.


     

  • Replied 8 September 2017, 12:42 pm EST

    Hello,


    Here is code to open all nodes in a hierarchy with n levels (where n can be any number).

     
      Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    OpenNodes(FpSpread1.Sheets(0))
    End Sub

    Private Sub
    OpenNodes(ByVal ss As FarPoint.Win.Spread.SheetView)
    Dim ss2 As FarPoint.Win.Spread.SheetView
    For i As Integer = 0 To ss.RowCount - 1
    If ss.ChildRelationCount > 0 Then
    ss2 = ss.GetChildView(i, 0)
    ss.ExpandRow(i, True)
    OpenNodes(ss2)
    End If
    Next
    End Sub
     
  • Replied 8 September 2017, 12:42 pm EST

    Thank you for your help Scotts!!!


     

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels