The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Grid Building: Expand and Contract Group Headers, Auto Group Command
Posted: 27 Jul 07 8:43 AM
|
Building a Grid on the fly, column by column....
what's the command to Group by Column(1)
WITH grdA >>> .GROUP(1)
END WITH
And how to I expand that group grdA.EXPAND ALL
and How do I contract them all graA.EXPAND FALSE
grdA.REFRESH
HAve done this in the past, but it's on another machine..... Thanks! |
|
|
|
Re: Grid Building: Expand and Contract Group Headers, Auto Group Command
Posted: 27 Jul 07 11:34 AM
|
Hi RJ,
To group by a column, you need to get a reference to the column and then set it's GroupIndex property (zero based - you can group by multiple columns the index determines the order of the grouped columns).
ie:
datagrid1.Columns.Item(0).GroupIndex = 0
To expand & collapse, you use Grid level methods:
Expand
datagrid1.ExpandAll
Collapse
datagrid1.CollapseAll
Make sense? |
|
|
| |
| |
| |
|
Re: Grid Building: Expand and Contract Group Headers, Auto Group Command
Posted: 11 Mar 08 2:23 PM
|
Hi RJ,
Just tested this in 7.2.2 gold and it works for me.
The integer value you set for the GroupIndex indicates the order of the groupings. If I have a grid of activities that include a contact and account name and I want to group by account first, then by contact, I would set the GroupIndex for the account column as 1 and then GroupIndex for the contact column as 2.
Make sense?
-Ryan |
|
|
| |
| |
|
Re: Grid Building: Expand and Contract Group Headers, Auto Group Command
Posted: 12 Mar 08 11:44 AM
|
Originally posted by RJ Samp
If GroupIndex values are 1-based, why does GroupIndex = 0 work? |
|
Well, maybe they are 0-based. Looks like it doesn't matter what numbers you use, as long as they are in order. I'll bet you could use 5 and 6 and it would still work fine (the lower number is grouped first).
Thanks.
-Ryan |
|
|
|
Re: Grid Building: Expand and Contract Group Headers, Auto Group Command
Posted: 12 Mar 08 2:31 PM
|
columns are 0 based, and Group Index's are numerical value based..... haven't tried identical indexes..... (or identical columns)
Thanks Ryan, this is looking GREAT (had to add a Product Name and OPPPRODUCTID columns together for a distinct product and use that as the Group header, OPPPRODUCTID alone was too ugly).
|
|
|
| |
|
Re: Grid Building: Expand and Contract Group Headers, Auto Group Command
Posted: 20 May 09 12:19 PM
|
Originally posted by Bob Nerren
How do you then turn off the grouping?. |
|
IIRC you just loop through the columns and set each columns GroupIndex to -1? It's been a while so not sure if I remember that right. Give it a try to see (you could also read an ungrouped column's GroupIndex to see what value it has and use that, but I think it is -1). |
|
|
| |
|