This is a migrated thread and some comments may be shown as answers.

Sorting among groups in RadGridView control

2 Answers 114 Views
GridView
This is a migrated thread and some comments may be shown as answers.
huy
Top achievements
Rank 1
huy asked on 16 Mar 2015, 02:32 AM
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 Answers, 1 is accepted

Sort by
0
huy
Top achievements
Rank 1
answered on 17 Mar 2015, 08:27 AM
Need helps urgently :(
0
Dimitrina
Telerik team
answered on 17 Mar 2015, 04:34 PM
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.

 
Tags
GridView
Asked by
huy
Top achievements
Rank 1
Answers by
huy
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or