Welcome to the Xceed Community | Help
Community Search  
More Search Options

Original sort order when sorting by group

Sort Posts: Previous Next
  •  08-23-2011, 2:59 PM Post no. 30906

    Original sort order when sorting by group

    There is probably a very simple flag for this... I have a dataset that comes presorted, it has a column called IsFavorite.  Imagine

    true result1
    true result2
    false result3
    true result4
    false result5

    When I group by IsFavorite and take the empty sort OR apply the ascending sort, I see (correctly)

    IsFavorite: false
    false result3
    false result5

    IsFavorite: true
    true result1
    true result2
    true result4

    However, if I apply the descending sort, the entire result set gets flipped upside down!

    IsFavorite: true
    true result4
    true result2
    true result1

    IsFavorite: false
    false result5
    false result3

    What I can do to preserve the original sort order when changing the group sort order?  In this case I've used numerical results, but imagine how it looks when the results were alphabetically sorted originally!

    Thank you in advance. 

    Respectfully,

    Tim 


  •  08-23-2011, 5:06 PM Post no. 30910 in reply to 30906

    Re: Original sort order when sorting by group

    Hi Tim,

    You can choose to sort by more than one Column and choose how to sort. So you can click on IsFavorite (descending) and then hold the Shift key and click on the Result column (Ascending). With this way, the user can choose to sort by as many columns as they want. This will also save a lot of overhead in order to program a default behavior and then have the user change it by sorting by multiple columns.


    Marc

    Developer in Technical Support
    Xceed - Multi-talented components - http://xceed.com
  •  09-01-2011, 8:48 AM Post no. 30965 in reply to 30910

    Re: Original sort order when sorting by group

    Dear Marc,

    I understand that the user can select another column to sort by, but it is still wierd.  Imagine instead fruits:

    non-tropical apple 
    tropical banana
    tropical durian
    non-tropical pear

    If you group by tropical, without sorting by the name, it should become

    non-tropical
    - apple
    - pear

    tropical
    - banana
    - durian

    If the user decides, oh, I want to see tropical at the top, and clicks the group to sort, anyone's expectation would be

    tropical

    - banana
    - durian

     non-tropical
    - apple
    - pear

    In my case, I have a Chinese dictionary with a particular sort order.  Having it flip upside down when the favorites is at the top vs the bottom is really wierd and undesireable.  If there is any help you can provide for this (anyone) it would be very much appreciated. 

     

  •  09-02-2011, 1:30 PM Post no. 30974 in reply to 30965

    Re: Original sort order when sorting by group

    Hi Tim, 

    This in fact was a design decision as we "reverse" the sorting for optimization so that we do not re-sort the rows, we simply flip them. 

    We understand that in certain scenarios that would give an undesirable feel as in your case.

    What we can suggest is that when you sort on the grouped column, to handle the PreviewMouseDown event on that ColumnManagerRow and force a sorting on your other column to un-reverse it.

    You can handle the previewMouseDown event through a style that targets ColumnManagerCell with an EventSetter.

    You can access the sort descriptions and change them through the SortDescriptions property on the DataGridCollectionViewSource: 

      (myGrid.ItemsSource as DataGridCollectionViewSource).SortDescriptions 

     

    I hope this helps.  

     


    Best Regards,

    Michel Dahdah
    Technical Support
    Xceed Software inc.
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.