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. 



  • Replied 8 September 2017, 12:42 pm EST


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

      <SPAN class=kwd>Private Sub</SPAN> Button1_Click(<SPAN class=kwd>ByVal</SPAN> sender <SPAN class=kwd>As Object</SPAN>, <SPAN class=kwd>ByVal</SPAN> e <SPAN class=kwd>As</SPAN> System.EventArgs) <SPAN class=kwd>Handles</SPAN> Button1.Click
    <SPAN class=kwd>End Sub

    Private Sub</SPAN> OpenNodes(<SPAN class=kwd>ByVal</SPAN> ss <SPAN class=kwd>As</SPAN> FarPoint.Win.Spread.SheetView)
    <SPAN class=kwd>Dim</SPAN> ss2 <SPAN class=kwd>As</SPAN> FarPoint.Win.Spread.SheetView
    <SPAN class=kwd>For</SPAN> i <SPAN class=kwd>As Integer</SPAN> = 0 <SPAN class=kwd>To</SPAN> ss.RowCount - 1
    <SPAN class=kwd>If</SPAN> ss.ChildRelationCount > 0 <SPAN class=kwd>Then</SPAN>
    ss2 = ss.GetChildView(i, 0)
    ss.ExpandRow(i, <SPAN class=kwd>True</SPAN>)
    <SPAN class=kwd>End If
    End Sub</SPAN>
  • 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