Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Tuesday, November 26, 2024 
 
slxdeveloper.com Community Forums  
   
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!
 Architect Forums - Controls
Forum to discuss usage & tips for SalesLogix controls and other 3rd party ActiveX controls. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to Controls | New ThreadView:  Search:  
 Author  Thread: ungrouping datagrid
Bob Nerren
Posts: 19
 
ungrouping datagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 May 09 7:28 AM
Ok. I give up. Looked through every post with the keyword "datagrid" and can't find an answer.

My question is: Once you've set a datagrid to turn on grouping (with the columns GroupIndex property), how do you turn it off?

Depending on the data being displayed on my grid, grouping will need to be turned on or off.

Thanks for the help and thanks for being an amazing resource for guys like me.
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: ungrouping datagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Jun 09 4:07 PM
Thought someone had posted this up here.....

here's my typical grouping stuff:
SET GridRS.ActiveConnection = Nothing
SET dgWORK.RECORDSET = GridRS
'' The GROUPING of the Header is based on the ITEM in the column, counted from left to right, zero based, visible or invisible.
''' SelectFirstRecordForGrid(DGWORK)
dgWORK.Columns.Item(TheGroupIndex).GroupIndex = 1
dgWORK.EXPANDALL

Get a recordset, disconnect it
put the recordset into the grid.
if you don't do this: dgWORK.Columns.Item(TheGroupIndex).GroupIndex = 1
will the new recordset show up as non grouped? Does setting the grid with a fresh recordset KO the grouping???

Or how about this:
dgWORK.Columns.Item(TheGroupIndex).GroupIndex = -1

I thought someone said that worked.

grid.showgrouppanel = FALSE of course.....

[Reply][Quote]
Guy Barrett
Posts: 63
 
Re: ungrouping datagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 26 Aug 09 7:36 AM
This is awesome, I was about to ask how to expand all of the groups on a groups grid and POW, there's the solution.

I have another question regarding this though...

How do I automatically expand all the grouped nodes when a user drags a column into the "Drag a column header here to group by that item". I can't see any event attached to the grid that would trap this.

Thanks in advance!
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: ungrouping datagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 26 Aug 09 11:45 AM
Here is a trick:

- Add the Summary Footer to the Grid (and add a field to it (something simple such as a Count).
- Add a handler for the GetSummary Event and call in the Grid.ExpandAll from within there


[Reply][Quote]
Guy Barrett
Posts: 63
 
Re: ungrouping datagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 26 Aug 09 2:11 PM
Genius!

However, this only works when you drag the first grouping column to the top. When you drag another one in, effectively making a group and a sub group, they all collapse back up again. My guess is it doesn't bother recalculating the footer for when the second group is added. I'm on v7.2.2 if that helps.

Any other ideas?
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: ungrouping datagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 26 Aug 09 2:52 PM
Yeap, I should put more than 2 columns on my test grid.

You could try other events, but not sure if they wil fit your conditions.
For instance, you could use the MouseUp event and track each column and their GroupIndex on a String, if there are any changes, ExpandAll

e.g.

Dim colStatus

Sub OnMouseApp....
Dim newColStatus
Dim i

for i = 0 to datagrid.columns.count - 1
newColStatus = newColStatus & datagrid.colums.items(i).Caption & ":" & datagrid.colums.items(i).GroupIndex & "|"
Next

If colStatus <> newColStatus then
datagrid.ExpandAll

colStatus = newColStatus
End If
End Sub

You are basically creating a long string that has all the columns listed with their group index. e.g. First Name:-1|Last Name:-1|Title:-1|Phone:-1|
So, lets say that you do move the Last Name column up to the group area, the Mouse Up fires upon the drop and now you get this string: First Name:-1|Last Name:0|Title:-1|Phone:-1|
Since the strings are different, you call ExpandAll.
If you then move up Title, now your string will be (assuming that you put title as your second group level): First Name:-1|Last Name:0|Title:1|Phone:-1|
If you then move Title to first group level: First Name:-1|Last Name:1|Title:0|Phone:-1|

[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 11/26/2024 11:18:02 AM