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
1750
Group by column "A" but sort by colunn "B"
posted

Hi community!

I have a list of data. I want to group the data by a certain column and would like to sort the groups by a different column. I read the thread http://ko.infragistics.com/community/forums/t/75182.aspx about the same issue and downloaded the code. In the example it is working like a charm.

I transfered the example code into my application but it looks as something is missing. I see that the custom implementation of IGroupByEvaluator is called also the custom SortComparer. But somehow the list is in the wrong order.

To clarify my gool, have a look at the attached picture. The groups are correct, but I want to sort by the last column in the view (red box). As the code contains some customer specific implementations, I would like to avoid to post the code here on the forum.
Is this possible? Thank you for you help.

Best regards
Andreas

  • 34690
    Offline posted

    Hello Andreas,

    If you are using the same GroupByEvaluator as in the linked forum thread, I would expect that your groups would be sorted by your "Auft..." field in this case.

    There is one thing from your screenshot that I am curious about, though. I see that it appears to be sorting in a sequential numeric order, and this leads me to wonder what the type is of your "Auft..." field? They appear to be integers, but if perhaps the IComparer that you are using for your GroupByEvaluator is evaluating those numbers as strings, I would expect that your fields would sort in the way that they currently are sorting. If your fields are sorting as strings, I would recommend casting the numbers to an int before comparing them in the Compare method of your IComparer.

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

    Sincerely,
    Andrew
    Associate Developer