AdvStringGrid grouping with column hide

Good morning,

it's possible use the grouping features while (in the grid) there are some hidden columns ?

For exampple grig with with 15 columns columns 5,8,14,15 are hidden with

AdvStringGrid.Hidecolumn(5);

AdvStringGrid.Hidecolumn(8);

AdvStringGrid.Hidecolumn(14);

AdvStringGrid.Hidecolumn(15);



Now i have 4 columns hidden (and the grid works).

Now i need to group for column 3

AdvStringGrid.Group(3) and good

Regroup for column 12

AdvStringGrid.Group(12) still work ..

Regroup for column 3

AdvStringGrid.Group(3) exception for grid index out of range (seems that the property column is not updated to new value).



Without using hidden columns all works great.



From this behavior the nature of my question.



Thank's for your reply

Regards

Daniele



If you want to use column hiding together with grouping, the sequence to use is:


perform grid group
hide columns

unhide columns
perform grid ungroup

Do not group after column hiding as the grouping itself already internally relies on hiding the grouped column.
1 Like

Hi Bruno,

thank's for reply.

It's the way i have adopted yesterday.

A nice way to approach this in "automatic" way could be inside the group procedure.

Infact into the procedure before proced to grouping first ungroup.

In the same way if some columns are hidden before grouping first unhide, ungroup, grouping, return to hide.

I know well you are very busy ... but one day ..



Thank's for all

Daniele