Professional User Interface Suite, Copyright FOSS Software Inc. Help Published with Permission.

There is a CExtReportGridSortOrder class that allows you to set sorting and grouping rules for the report grid. You can pass an instance of this class to a report grid using the CExtReportGridWnd.ReportSortOrderSet() method. Here is sample code that shows how the report grid can be sorted and grouped by two columns:

CExtReportGridWnd & wndReportGrid = . . .
CExtReportGridColumn * pRGC1 = . . .
CExtReportGridColumn * pRGC2 = . . .
bool bAscending1 = . . .
bool bAscending2 = . . .
CExtReportGridSortOrder rgso;
rgso.ColumnInsert( pRGC1, -1, bAscending1 );
rgso.ColumnInsert( pRGC2, -1, bAscending2 );
rgso.ColumnGroupCountSet( 2 );
wndReportGrid.ReportSortOrderSet( rgso, false, true );
wndReportGrid.ReportSortOrderUpdate(true);

You can also cancel any applied rules by passing an empty CExtReportGridSortOrder object to ReportSortOrderSet():

CExtReportGridSortOrder rgsoEmpty;
wndReportGrid.ReportSortOrderSet( rgsoEmpty, false, true );