Skip to content

Infragistics Community Forum / Desktop / Ultimate UI for Windows Forms / Multiple column Sort on Ultrawingrid

Multiple column Sort on Ultrawingrid

New Discussion
Swapna
Swapna asked on May 22, 2009 2:12 PM

Hi

I have three (3) columns. When we sort descending/ascending on the first column then it should automatically sort the others ascending. Please let me know how to approach this issue. Thanks.

Sign In to post a reply

Replies

  • 0
    Mike Saltzman
    Mike Saltzman answered on Aug 27, 2008 2:16 PM

     There are two ways you could go about this.

    1) You could trap the BeforeSortChange event and use the SortedColumns.Add method to sort each column. 

    2) You could use the SortComparer property on the column. You would create a class that implements IComparer and you could write code in the Compare method to examine the values in all of the columns to sort in the order you want. 

    • 0
      Swapna
      Swapna answered on Aug 27, 2008 3:04 PM

      I think we can't proceed with the first approach as we cannot modify the sorted columns list while we are in the BeforeSortChange event. I will try writing my own sort comparer. Thanks.

       

      • 0
        Mike Saltzman
        Mike Saltzman answered on Aug 28, 2008 2:14 PM

        Why can't you modify the collection inside the BeforeSortChange event? Are you getting an exception?

      • 0
        Douglas
        Douglas answered on May 21, 2009 9:14 PM

        So there is no multi-column sort capability built in? Is there any plan to? This seems pretty basic.

      • 0
        Mike Saltzman
        Mike Saltzman answered on May 22, 2009 2:12 PM

        Yes, the grid has multi-column sorting built in. You just set the HeaderClickAction to SortMulti.

        But I thought this discussion was about sorting 3 columns when the user only clicks to sort one.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Swapna
Favorites
0
Replies
5
Created On
May 22, 2009
Last Post
17 years, 3 months ago

Suggested Discussions

Tags

Created by

Created on

May 22, 2009 2:12 PM

Last activity on

May 22, 2009 2:12 PM