Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
3555
Sorting when using Group By
posted

I set an initial sort order, but when I call this method when a field is in group by mode it seems to reset the grid, removing the group by state.  What am I doing wrong?

        private void DefaultSort()
        {

            UltraGridBand band = grdCompliance.DisplayLayout.Bands[0];

            grdCompliance.DisplayLayout.Bands[0].SortedColumns.Clear();

            //Sorting
            band.SortedColumns.Add(grdCompliance.DisplayLayout.Bands[0].Columns["CountrySequence"], false);
            band.SortedColumns.Add(grdCompliance.DisplayLayout.Bands[0].Columns["PopulationSequence"], false);
            band.SortedColumns.Add(grdCompliance.DisplayLayout.Bands[0].Columns["PricingDrugSequence"], false);
        }

  • 469350
    Suggested Answer
    Offline posted

    Sorting and grouping are tightly linked. In order to group the the grid, you add the column to the SortedColumns collection and specify true for groupBy.

    So when you clear the SortedColumns, you are clearing the grouping, as well. So you probably need to add the grouped column back into the SortedColumns collection to maintain the grouping.