Grouping problems

Ok. I really tried to do everythink like it is described in the manual, but it simply doesn't work. My problem is this:



I would like to group this by the column Type. But if I say

MyGrid->Group(1);  // ..or any other index

it fails. Anyway.. this is TDBAdvGrid component and data is from TADOTable.

Any help?
Thanks in advance.

P.S: Using C++ Builder 2010.

Kovacevic Zeljko2010-05-29 15:55:02

...double post.
Kovacevic Zeljko2010-05-28 10:42:17

Did you set grid.PageMode = false

which is needed when you want to use the grid's internal grouping features.

Yes. That was the problem.

Thanks!

I noticed this:



Why is the header "Size" in the different color? Can I disable it?

Can you clarify?

Can you please provide more information on this grid, like property settings, event code used, ...
Please contact us by email for these details.

Code:
MyGrid->Group(2);

Look property was set to glWin7 and I see now that was (still is) the problem. After i change that property to glWin7 and later put it back to glXP (or whatever style) it still uses glWin7 for the last column.

So, you can reproduce like this:

1. Add a TDBAdvGrid and define a Dataset property
2. Change a "look" property to glWin7
3. Change it back to glXP (or any other else)  // you dont even need to compile after step 2.
4. Group by some column using Group(..)

and you will see it. So, my quess is that there is some bug when changing look property.
Kovacevic Zeljko2010-06-02 08:27:28

This problem is traced & solved. Next update of TDBAdvGrid will address this.
To workaround with the current version, after setting grid.Look = glXP , set grid.SortSettings.HeaderColor := clNone

Thanks

Suggestion: You could add conditional grouping. Like,

event: onCustomGroup

TForm1::OnCustomGroupFunction(.....){
    Accept = MyDataset->FieldByName("Field")->AsString == "May";
}

TForm1::Button1Click(....){
    Grid1->CustomGrouping = true;
}

I'm not sure I understand how this should work.
When would this event be triggered ?

Ok. It seems that I miscalculated a bit. I
just wanted to ask whether it is possible to group based on a set of
values that are found in a field (vector) and not only based on the name
of the column.
For example,

int values [5] = (20, 40, 60, 80, 100);  // percent

Now, I would like to group the success of students on their exams by this. Like 0-20%, 20-40% ... 80-100%.

Hell, i have a problèm with grouping by a XX on a Slave TDBADVGrid:

I have 2 TTables in master/slave relationship. DBADVGrids are used to display informations
In the Slave DBadvGrid, i want to group data by column (i).

i follow your sample but it simply not working.

Putting the slave grid.pagemode:=false doesn't resolve the problem, furthermore, data are no more displayed on the slave grid,

how can i fix this problem.
is there any other solution.