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

SortMemberPath and GroupMemberPath does not work with multiple elements in Collection

2 Answers 202 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Nalini
Top achievements
Rank 1
Nalini asked on 14 Apr 2015, 11:38 PM

I am working on one module where user can have multiple addresses and phones. I can see data in UI.

The problem is that sorting and grouping does not work with Telerik:GridViewDataColumn. I tired for long time, please help me on this.

 

Please see below code for your reference.

 

 <telerik:GridViewDataColumn Width="0.14*"
                                                Header="{Binding [City], Source={StaticResource Labels}}"
                                                SortMemberPath="XePatientAddress.City"
                                                GroupMemberPath="XePatientAddress.City"
                                                DataMemberBinding="{Binding XePatientAddress, Converter={StaticResource ListConverter}, ConverterParameter=City}" />
\<telerik:GridViewDataColumn Width="0.12*"
                                                Header="{Binding [Phone], Source={StaticResource Labels}}"
                                                DataMemberBinding="{Binding XePatientAddress, Converter={StaticResource ListConverter}, ConverterParameter=Phone:PhoneConverter}"
                                                SortMemberPath="XePatientAddress.Phone"
                                                GroupMemberPath="XePatientAddress.Phone" />

2 Answers, 1 is accepted

Sort by
0
Nalini
Top achievements
Rank 1
answered on 15 Apr 2015, 12:10 AM

 XePatientAddress is maxOccurs='unbounded' in model

 

0
Dimitrina
Telerik team
answered on 17 Apr 2015, 09:33 AM
Hi Nalini,

I will 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 can build and execute such a valid query, 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 and advise further. 


Regards,
Dimitrina
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

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