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
1865
FieldSortDescription
posted

My sorted field has strings. A couple of strings start with '~' and all others with alphabets. The ASCII value of ~ is higher than alphabets but the strings starting with ~ show in the beginning. How do I make sure that they are always at the end when sorting order is ASC.

Thanks.

Parents
  • 34810
    Offline posted

    Hello Jay6447,

    Thank you for your post!

    The XamDataGrid uses the standard .NET Framework sort comparisons when sorting fields, and after some investigation, it appears that this behavior you are seeing is expected. For example, if you called the following code:  int I = string.Compare("~", "any alphabetic character (A-Z)"), you will notice that I will be -1, meaning that "~" comes before alphabetic characters in this case.

    If you would like your "~" characters to show up after your alphabetic characters when applying an ascending sort to your XamDataGrid, I would recommend that you define a custom sort comparer for the field you wish to sort. Here is a link to a separate forum thread where custom sorting in the XamDataGrid is discussed: http://es.infragistics.com/community/forums/p/57047/292051.aspx.

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Associate Developer
    Infragistics Inc.
    www.Infragistics.com/support

Reply Children
No Data