C1 Community
ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

Adding a grouping column?

rated by 0 users
This post has 4 Replies | 2 Followers

Top 500 Contributor
Posts 19
maurymarkowitz Posted: Fri, Apr 11 2008 2:46 PM
The documentation for both Add and GroupColumns says the syntax is: object.Add (item) so I did this: TDBGrid1.GroupColumns.Add(TDBGrid1.Columns("Portfolio")). This complains that "argument not optional". Looking at the tooltip that pops up, it appears I need an "Index as Integer" so I changed it to TDBGrid1.GroupColumns.Add(0, TDBGrid1.Columns("Portfolio")), but according to VB, this is a syntax error. I solved that with x = TDBGrid1.GroupColumns.Add(0, TDBGrid1.Columns("Portfolio")), but now the resulting grid is grouped by column 0, not "Portfolio". So what is the proper syntax for this?
Top 500 Contributor
Posts 19
Also, the documentation states that you need DataView=2 and AllowColMove=True. It appears that AllowColSelect=True must also be on?
Top 10 Contributor
Posts 1,090

Hello,

 

Regarding your query on GroupColumn property of TrueDBGrid, I  am attaching a sample project that will illustrate the same. In this sample application we have not set the AllowColSelect to true however the AllowColMove should be set to true.

 

 

Regards,

Gary

 

<maurymarkowitz> wrote in message news:203769@10.0.1.98...
The documentation for both Add and GroupColumns says the syntax is: object.Add (item) so I did this: TDBGrid1.GroupColumns.Add(TDBGrid1.Columns("Portfolio")). This complains that "argument not optional". Looking at the tooltip that pops up, it appears I need an "Index as Integer" so I changed it to TDBGrid1.GroupColumns.Add(0, TDBGrid1.Columns("Portfolio")), but according to VB, this is a syntax error. I solved that with x = TDBGrid1.GroupColumns.Add(0, TDBGrid1.Columns("Portfolio")), but now the resulting grid is grouped by column 0, not "Portfolio". So what is the proper syntax for this?

http://helpcentral.componentone.com/cs/forums/p/74928/203769.aspx#203769

Top 500 Contributor
Posts 19
"In this sample application we have not set the AllowColSelect " Uhhh, yes it is... and turning if off makes grouping fail :-) I'd really prefer to have a completely separate switch for this, AllowColGrouping, that would allow it in spite of the other two settings.
Not Ranked
Posts 1
shinz62 replied on Mon, May 4 2009 3:28 PM

I'm having the same problem. I tried downloading your example but there is no example code to answer this question. What is the proper use of the GroupColumns.Add()? It doesn't work as advertised. I had the exact same result as Maury, that is on the first call to the GroupColumns.Add() routine it added the 0 column, not the one I wanted, and the second call aways fails, says Invalid index for any index I try. 

Page 1 of 1 (5 items) | RSS
Contact ComponentOne: 1.800.858.2739 ©1987-2010 ComponentOne LLC All Rights Reserved.