Current filter:
                                You should refresh the page.
                                  • How can I ensure that expanding a group row collapses the (only) other group row that is currently expanded? Is there a way to accomplish this?

                                1 Solution

                                Creation Date Importance Sort by

                                To achieve the desired result, you can use the GridView's OnMouseDown event handler and check hit information there. If the expand button is clicked (HitTest object is a TcxGridExpandButtonHitTest) and a corresponding row is expanded, you should iterate through all GroupRows and collapse them (except clicked group row).

                                Attached is an example that demonstrates this approach in action.

                                • Michael Mitchell 01.12.2015

                                  The provided sample only works if there is a single grouping.  The addition of the commented line seems to work better.

                                  [Delphi]
                                    for I := RowCount - 1 downto 0 do     if (Rows[I] is TcxGridGroupRow) AND (Rows[I] AS TcxGridGroupRow).Expanded then       if NOT (Rows[I] = TcxGridExpandButtonHitTest(AHitTest).GridRecord)          // Ensure levels are the same           AND  (Rows[I].Level = TcxGridExpandButtonHitTest(AHitTest).GridRecord.Level) then         (Rows[I] AS TcxGridGroupRow).Collapse(False);
                                • Mikhail (DevExpress Support) 01.13.2015
                                  Thank you Michael. It may be helpful for other customers with a similar task.