SortMemberPath and GroupMemberPath does not work with multiple elements in Collection

3 posts, 0 answers
  1. Nalini
    Nalini avatar
    9 posts
    Member since:
    Apr 2015

    Posted 14 Apr 2015 Link to this post

    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. Nalini
    Nalini avatar
    9 posts
    Member since:
    Apr 2015

    Posted 14 Apr 2015 in reply to Nalini Link to this post

     XePatientAddress is maxOccurs='unbounded' in model

     

  3. DevCraft banner
  4. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 17 Apr 2015 Link to this post

    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.

     
Back to Top