Sorting among groups in RadGridView control

3 posts, 0 answers
  1. huy
    huy avatar
    2 posts
    Member since:
    Apr 2014

    Posted 15 Mar 2015 Link to this post

    Dear Ad,

    I would like to ask you a question that is about Sorting among groups in RadGridView control.
    Look at the attachment.
    1) when column is not grouping, I CAN sort size basing on Description then Length. (multi-criteria  sorting).
    2) when column is grouped by Size, a box of Size at grouping area permits users to sort among group. The problem is; that sorting based on Caption/String of size.
    The picture is showing 2x2 > 2x14 but actually I want  2x14 > 2x2 in this case.
    I dig in this a lot, such as rebinding SortDescriptor at the event of grouping but looks like group-sorting is run at the last and noway to cancel it.
    I called e.Cancel = true already, but this action seemed to make group-sorting disable like loosing this function on UI.

    Please help me on "multi-criteria  group sorting".

    Thanks
    Hao
  2. huy
    huy avatar
    2 posts
    Member since:
    Apr 2014

    Posted 17 Mar 2015 in reply to huy Link to this post

    Need helps urgently :(
  3. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 17 Mar 2015 Link to this post

    Hi,

    Indeed, trying to sort when clicking on any column will not affect the order of the grouped rows. In case you would like to sort the Group, you should sort the grouped item in the group panel.  Once you remove the Grouping, then you will be able to successfully sort on a column level also.

    Generally, when sorting on a column in a grouped GridView, the sorting should affect the individual items in each group and not the order of the grouped rows. 

    I will also try elaborating a bit more on how the sorting and grouping in RadGridView work. They are data operations and we internally generate and execute a LINQ query appending a OrderBy or GroupBy clause to the source collection. 
    For example, when sorting on a Description property of the bound item, the generated query would be:
    var result = GridViewSourceCollection.OrderBy(x => x.Description);
    So, if you can build such a LINQ query appending OrderBy clause based on the DataMemberBinding or other member specified, then RadGridView will also be able to sort the respective column. Otherwise, this will not be possible.

    In case you still have any doubts, would it be possible for you to isolate the exact case in a demo project illustrating it and send it to us via a new support thread? You can take a look at this blog post for a reference on how to isolate an issue. That way I can debug it with the source code to confirm whether we may consider it as a bug. 

    Regards,
    Dimitrina
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top