Print Page | Close Window

Xtreme Report: how to collapse/Expand all

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=3544
Printed Date: 28 April 2024 at 5:43am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Xtreme Report: how to collapse/Expand all
Posted By: Davide
Subject: Xtreme Report: how to collapse/Expand all
Date Posted: 21 January 2006 at 11:54am
Hi All,
    I am trying to collapse/Expand all group when a grouping view is activated. I am trying to do it so

                 If AxReport.ShowGroupBox Then
                     For Each report_row In AxReport.Rows
                          If report_row.GroupRow Then
                              report_row.Expanded = False
                          End If
                     Next report_row
                 End If

but it does not work. Better, it works only the first time I collapse all the grouped rows.

Thanks
Davide



Replies:
Posted By: sserge
Date Posted: 21 January 2006 at 2:58pm
Hi Davide,

When you set Expanded property to False, you force rows to be collapsed. Following piece of code reverts Expanded state:

Dim report_row As ReportRow
If AxReport.ShowGroupBox Then
    For Each report_row In AxReport.Rows
        If report_row.GroupRow Then
             report_row.Expanded = Not report_row.Expanded
        End If
    Next report_row
End If


--
WBR,
Serge


Posted By: Davide
Date Posted: 21 January 2006 at 4:50pm

Hi seerge, the code lines in my post are those I use to collapse my groups rows. Naturally, the ones I use to expand my rows are the same you have posted. The problem is that this does not work.

What I do:

1) Read a recordset from a database

2) Add records to the report

3) Call the populate method ( so the rows are generated)

4) Activate the group box view

5) Drag'n'Drop a Column Header in the group box

All the rows are now grouped and expanded

6) Press a button that fires up the Collapse code (the code in my post)

It works....

7) Press a button that fires up the Expand code (the same sserge posted)

It doesn't work....

If I click a column header to sort rows by that column all the group returns expanded, but my button doesn't work anymore. Executing code line by line I have seen that the execution skip to 'End If' (with reference to the code previously posted) exactly as the report was zero rows populated.

Some Hint?

Davide



Posted By: sserge
Date Posted: 22 January 2006 at 5:09am
Davide,

If you have different buttons for expand / collapse then just try to set Expanded to True.

report_row.Expanded = True


--
WBR,
Serge


Posted By: SuperMario
Date Posted: 23 January 2006 at 7:31am
Have you looked at our samples?  I.e. in the Report sample if you right-click on a group row you have the option to expand\collapse all rows.


Private Sub mnuCollapseAllGroups_Click()
    Dim GroupRow As ReportRow
    For Each GroupRow In wndReportControl.Rows
        If GroupRow.GroupRow Then
             GroupRow.Expanded = False
        End If
    Next
End Sub

Private Sub mnuExpandAllGroups_Click()
    Dim GroupRow As ReportRow
    For Each GroupRow In wndReportControl.Rows
        If GroupRow.GroupRow Then
             'Expand Group Row
             GroupRow.Expanded = True
        End If
    Next
End Sub


This code works fine in our sample.  If you want to keep grouping, you will have to remember the expand\collapse state then after a sort using the SortOrderChanged event you must restore the expand state.


Private Sub wndReportControl_SortOrderChanged()
    If bCollapsed Then
        mnuCollapseAllGroups_Click
    End If
End Sub




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net