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
495
SortedColumns entry gets lost when GroupBy-Column is dragged from GroupBy Area
posted

I have exactly the same issue. I have two columns sorted, Client and Rig. I sorted both by Shift-clicking each column. SortIndicators are shown on each column header. I then drag the Client column to the GroupBy box. It still has the sort indicator on it as does the Rig column. I then drag the Client column from the GroupBy box into the grid again and it no longer has the sort indicator on it and the grid is now only sorted by the Rig column. I have put put a breakpoint in the AfterSortChange handler and I see that the Band.SortedColumns.Count is 2 before I drag the column into the GroupBy box. Then when I drag the column back into the grid, Band.SortedColumns.Count is 1. So I have tried this with no success:

        private void ultraGrid1_AfterSortChange(object sender, BandEventArgs e)
        {
            if (m_bInAfterSortChange)
                return;

            m_bInAfterSortChange = true;
            if (e.Band.Columns["Client.NAME"].SortIndicator != SortIndicator.None)
            {
                e.Band.SortedColumns.Add("RIG", e.Band.Columns["Client.NAME"].SortIndicator == SortIndicator.Descending);
            }
            else if (e.Band.Columns["RIG"].SortIndicator != SortIndicator.None)
            {
                e.Band.SortedColumns.Add("Client.NAME", e.Band.Columns["RIG"].SortIndicator == SortIndicator.Descending);
            }
            m_bInAfterSortChange = false;
        }

What do I need to do the make the GroupBy functionality work properly?

Parents
No Data
Reply
  • 53790
    posted

    Hello Davidsimmonds,

    Maybe one possible approach to achieve desire behavior is set the property for example:
    - e.Band.Columns["Column Key"].SortIndicator = Infragistics.Win.UltraWinGrid.SortIndicator.Descending;
    in the same event. Other approach is to use the method that you already mentioned by this way:
    - e.Band.SortedColumns.Add("Column Key",true);
    Where the “true” parameter indicates that the column should be Grouped By.

    Could you please take a look at the attached sample for more details. Please let me know if you have any questions
    Regards

    UltraGridMultiSortColumns.zip
Children
No Data