Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - Xtreme Report: how to collapse/Expand all
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Xtreme Report: how to collapse/Expand all

 Post Reply Post Reply
Author
Message
Davide View Drop Down
Newbie
Newbie


Joined: 21 January 2006
Location: Italy
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote Davide Quote  Post ReplyReply Direct Link To This Post Topic: Xtreme Report: how to collapse/Expand all
    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
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Davide View Drop Down
Newbie
Newbie


Joined: 21 January 2006
Location: Italy
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote Davide Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.