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
478
Having trouble with sorting and grouping?
posted

 I've just spent a couple of days tracking this down, so hopefully I can save someone else the trouble.

 My problem was that I have data which is sorted by a database query displayed in a grid with ViewType="OutlookGroupBy", and the sorting was getting lost whenever someone grouped a column. Having spent much time trying to fix this by setting sorting on the columns (inefficient, without much success) I finally realised that it's because the default sorting algorithm is QuickSort, which is unstable - which is to say that it does not preserve the original order of elements with the same sort key value.

 All that's needed to make this work properly is to set the sort algorithm (either the default sorting algorithm in Display Layout, or at the band or column level) to one of the stable sorting algorithms: BinaryTreeSort, BubbleSort, or InsertionSort.