How to use the ListView Grouping?


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Nope, sorry. Ermm
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
One more thing, is there a way to add an image to the GroupHeader only?

Edhy Rijo

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Glad it helped, Edhy. Wink
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Trent L. Taylor (06/09/2008)
When you set the e.GroupHeaderText value, any row that has the same text will appear in the same group. That is it...not anything more to it.

So if you are trying to sort, you could include this as part of a BO sort or part of a query sort. Hope that makes sense.




Trent, Ivan,

That was it, having the proper ORDER BY in the fill method of the BO and just setting the GroupHeaderText to a value that is part of the row will do the trick. This is my code:



Private Sub lvPaymentSchedule_RowPopulating(ByVal e As MicroFour.StrataFrame.UI.Windows.Forms.RowPopulatingEventArgs) Handles lvPaymentSchedule.RowPopulating

Dim loBO As PaymentScheduleBO

loBO = e.BusinessObject

e.UseGroup = True

e.GroupHeaderText = "Vehicle Group " & loBO.FK_Vehicle.ToString

End Sub





Thanks you both! Smile


Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
I don't understand your question, but the the rows are grouped based on the GroupHeaderText.  When you set the e.GroupHeaderText value, any row that has the same text will appear in the same group.  That is it...not anything more to it.  Also, if you eve set the e.UseGroup to False, this gets set for the entire grid, not a per item basis.  But it still needs to be set within this method in order to take action.

So if you are trying to sort, you could include this as part of a BO sort or part of a query sort.  Hope that makes sense.

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Have you tried sorting the contents of your BO on the column you are using for grouping?
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Ok, I have the group showing, but since this method is executing per row, how do I filter the rows to show in the correct group? so the records for group 1 will be show under group 1 and the records for group 2 will be shown in group 2 and so on.

Edhy Rijo

Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Ivan,

Thanks, that will get me going, will try now.

Edhy Rijo

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hey Edhy.

Just to get you going, use your ListView RowPopulating Event to set e.UseGroup to True. Then you set the e.GroupHeaderText to the Group you want and it should work. Something like:

    Private Sub MyListView_RowPopulating(ByVal e As MicroFour.StrataFrame.UI.Windows.Forms.RowPopulatingEventArgs) _
      Handles MyListView.RowPopulating

        With CType(e.BusinessObject, MyBO)
            '-- Set Columns
            e.Values(0).DisplayValue = Something
            e.Values(1).DisplayValue = SomethingElse

            e.UseGroup = True

            Select Case .myField
                Case SomeCondition1
                    e.GroupHeaderText = "Group1"

                    '-- here you can even set an image, for example from a ImageListControl
                    e.ImageIndex = 1

                Case SomeCondition2
                    e.GroupHeaderText = "Group2"
                    e.ImageIndex = 2

                Case SomeCondition3
                    e.GroupHeaderText = "Group3"
                    e.ImageIndex = 3

                Case SomeCondition4
                    e.GroupHeaderText = "Group4"
                    e.ImageIndex = 4

                Case Else
                    e.GroupHeaderText = "Not Defined"
                    e.ImageIndex = 5
            End Select

        End With
    End Sub


Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Trent,

I saw this listview from one of your videos and now I have the need to incorporate this grouping feature in one of my listview.

I looked in the forum and the help file and could not find any info about how to do this.  Could you please post some sample code on how to accomplish this grouping display in the listview?

Edhy Rijo

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search