Grouping in the Spread

Posted by: himaheshh on 8 September 2017, 1:53 pm EST

  • Posted 8 September 2017, 1:53 pm EST

    Hi,


    I am trying to display information as shown below....Is it possible using the Spread for Winforms?


      Step: 1 - The grid is grouped so that the Monthly break up and the weekly break up below the yearly data is hidden.

































     Employee NumberEmployee NamePeriodAgeBase SalaryHRAAllowanceDeductions
    +1JohnYear 20083012345123412312


     Step: 2 - When the "+" sign in the Yearly data row is expanded, the monthly break up should be displayed as below











































     Employee NumberEmployee NamePeriodAgeBase SalaryHRAAllowanceDeductions
    -1JohnYear 20083012345123412312
    +1JohnMonth1301028.75102.833333310.251


     Step: 3 - When the "+" sign in the Monthly row is expanded, the weekly row should get displayed...


     

















































































     Employee NumberEmployee NamePeriodAgeBase SalaryHRAAllowanceDeductions
    -1JohnYear 20083012345123412312
    -1JohnMonth1301028.75102.833333310.251
     1JohnWeek13051.43755.150.8541666670.05
     1JohnWeek23051.43755.150.8541666670.05
     1JohnWeek33051.43755.150.8541666670.05
     1JohnWeek43051.43755.150.8541666670.05


     


    Thank you!


     


    Regards


    Mahesh

  • Replied 8 September 2017, 1:53 pm EST

    Mahesh,

    Yes it can be achieved using the Spread control. Please take a look at the HierarchyVB or HierarchyCS sample project which gets installed with the Spread control. You may locate it at the following location in your machine:

     C:\Program Files\FarPoint Technologies\Spread.WinForms.4.dotNet20\v4.0.2009\Samples

    Thanks

  • Replied 8 September 2017, 1:53 pm EST

    Thanks Suresh!


    It helped me a lot and saved me lots of time too..


    Couple of questions one this,


    1. Is it possible to Expand or collapse all the views (both parent and child) on a button click?


    2. Vertical Scroll bar.. I am not very happy with the way the scroll bars work in this scenario. If I scroll down, it takes me to the bottom rows..What if I want to scroll row by row?


     Regards


    Mahesh

  • Replied 8 September 2017, 1:53 pm EST

     


    Hello Mahesh,


    To Expand all the views you can use the following code:


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


    Dim i As Integer


    For i = 0 To fpSpread1.ActiveSheet.Rows.Count - 1


    FpSpread1.ActiveSheet.ExpandRow(i, True)


    Dim CV As FarPoint.Win.Spread.SheetView = FpSpread1.ActiveSheet.GetChildView(i, 0)


    If CV IsNot Nothing Then


    For j As Integer = 0 To CV.Rows.Count - 1


    CV.ExpandRow(j, True)


    Next


    End If


    Next


    End Sub


    Change "True" to  "False" in the same code to collapse expanded views.


    I did check the scroll behavior of the Vertical Scroll bar using the Sample discussed earlier by Suresh with the latest release of Spread for Windows, and found that every child grid has it's own vertical scroll bar. When we have expanded view, if we click on vertcal scroll button for the parent grid or child grid, it is moving Row by Row.


    Let me know if you have further questions.


    Regards,


     


     


     

  • Replied 8 September 2017, 1:53 pm EST

    Thanks Deepak!


    I have another question, When you have n nunmber of child views(grids) as in my earlier example, is it possible to set the indent to zero so that all the child views appear(start) from the same point horizontally?


    I am still working on the layouts, so couldnt provide you an scenario where the scroll bar is an issue. I will get back to you on that.


    Thanks a lot!


     Regards


    Mahesh

  • Replied 8 September 2017, 1:53 pm EST

     


    Hello Mahesh,


    Currently horizontal indention for child views is not supported.Refer to thread , for more information on it.


     


    Thanks,


     

Need extra support?

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

Learn More

Forum Channels