A few questions about (sub)grouping

Hello I am a fresh user of TAdvStringGrid.

I have played a bit with the grid and loaded approx. 5000 records with 20 columns.
After loading the file in the grid I tried to group the grid at three levels by using this code:

  AdvStringGrid1.MoveColumn(6,1);  // Move “Category” as first column
  AdvStringGrid1.MoveColumn(5,2);  // Move “SubCategory” as second column
  AdvStringGrid1.MoveColumn(5,3);  // Move “Date” as third column
  AdvStringGrid1.Group(1);         // Group on “Category”
  AdvStringGrid1.SubGroup(1);      // Group on “SubCategory”
  AdvStringGrid1.SubGroup(2);      // Group on “Date”
  AdvStringGrid1.GroupSum(7);      // Add Sum of value column 7
  AdvStringGrid1.GroupSum(8);      // Add Sum of value column 8
  AdvStringGrid1.GroupSum(9);      // Add Sum of value column 9
  AdvStringGrid1.GroupSum(10);     // Add Sum of value column 10
  AdvStringGrid1.ContractAll;      // Contract All nodes

My first question:

Grouping takes
relatively long (20 seconds). Is this the correct way to code grouping and subgrouping?
Does anybody has a suggestion to speed-up this (sub)grouping?

Question 2:

ContractAll doesn’t
contract all nodes. Just the nodes from the “Main group” (Category). Is it
possible to contract also the subgroup nodes by code?

Question 3:

Groupsum(1) just
adds the summary per group (in my case per “Category”). Is it possible to a
groupsum to a subgroup? I could not find a SubGroupSum, SubGroupAvg…. methods.

Question 4:

Is it possible to show the column group summaries as individual values in the groupheader? When I use the mergesummary := true and mergeheader := true, the sum values from all 4 columns are summarized

Thanks for your help.


  1. We've seen with 5000 rows subgrouping seems to make it slow. We'll investigate this deeper.
    2) I could not see an issue here with ContractAll. It contracts all nodes. Subnodes are not visible within contracted main nodes, so it is not clear how you can see not contracted subnodes when nodes are contracted.
    3) There is currently unfortunately not a subgroupsum function available.
    4) When MergeSummary = true, the summary line becomes one merged cell and can hold only one value. If you want different values in the summary line, you'd need to set MergeSummary = false.


As soon as I expand one main groups, I see all subgroups with all nodes expanded.

Could you please add this to the wishlist?

Yes I noticed that.
Thanks for your reply

  1. It is by design that when opening a node, it will also immediately open child nodes.
    3) Added