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
220
Custom Sort Order with IEnumerable
posted

Hello, first post here.

 

Edit: "

The following code I'd like to use to sort one of my columns:

 

        Char[] myArr = new Char[1] { 'A', '!', 'B', 'C', '$' };

        IEnumerable<char> yourOriginalValues;

 

        yourOriginalValues = myArr;

 

        IEnumerable<char> result =

               yourOriginalValues.Where(c => Char.IsLetterOrDigit(c))

                    .OrderBy(c => c)

                    .Concat(yourOriginalValues.Where(c => !Char.IsLetterOrDigit(c)));

 

"

So far I have 

        private void ultraGridDaySheet_InitializeLayout(object sender, InitializeLayoutEventArgs e)

        {

            e.Layout.Override.HeaderClickAction = HeaderClickAction.ExternalSortMulti;

        }

Parents
  • 469350
    Offline posted

    Hi,

    If you want to sort a column in a custom order, then the thing to do it implement the IComparer interface and then set the SortComparer property on the column to an instance of the implementor.

    If you do a search on these forums for "IComparer" or "SortComparer", I'm sure you'll find a whole bunch of sample code.

Reply Children