As @Uli Gerhardt mentioned, your desired behavior is what a TcxDBGridTableView
will do out of the box. You must have changed the behavior, possibly altering the view's
OptionsCustomize.GroupBySorting
This will enable exactly what you describe. From the DevExpress help:
Specifies whether sorting data by a column results in grouping by this
column.
Syntax
property GroupBySorting: Boolean;
Description Enabling the GroupBySorting option allows you to emulate
the behavior of MS Outlook 2003. This implies that clicking a column
header results in grouping data by the clicked column's values. The
previously applied grouping is cleared in such cases. If the
GroupBySorting option is disabled, clicking a column header results in
sorting data by this column's values.
Note that the GroupBySorting option has no effect if sorting via code.
The default value of the GroupBySorting property is False.