Sort groups themselves by a field other than the group field property

16 posts, 0 answers
  1. Garrett
    Garrett avatar
    7 posts
    Member since:
    Apr 2012

    Posted 25 Jun 2012 Link to this post

    I have a grid containing sports teams and their associated stats, grouped by the team name. I want to sort the groups themselves (not the stats inside of the groups) by newest to oldest stats. Each stat has a timestamp for when it was added to the system.

    Basically I need to list the stats of the teams who have most recently played a game at the top of the list.

    Anyone know who to accomplish this?
  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2895 posts

    Posted 28 Jun 2012 Link to this post

    Hello Garrett,

    I am not sure if I understood you correctly.
    In case you want to group by team name and sort the groups themselves not by their name, but by date - I am afraid that this scenario is not possible. When the dataSource is grouped, the its data is sorted ascending or descending by the field it is grouped by.

    If you want to group by field: team and sort the records inside the groups by date, you could use the following configuration:
    var dataSource = new kendo.data.DataSource({
        group: { field: "team" },
        sort: { field: "date", dir: "desc" },
        //.....
    });

    In this fiddle you can see the approach in action. I hope this helps.

    Regards,
    Alexander Valchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Garrett
    Garrett avatar
    7 posts
    Member since:
    Apr 2012

    Posted 28 Jun 2012 Link to this post

    Thanks for the reply, unfortunately I was looking for the first scenario, to be able to sort the groups themselves by date. For the time being I can live without the date sorting, but would this be something you guys would be planning to add in the future?

    Thanks again for the reply, really appreciate it!
  4. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2895 posts

    Posted 03 Jul 2012 Link to this post

    Hello Garrett,

    I am afraid that the implementation of such functionality is not in our immediate plans. I would recommend submitting this as a feature request in our user voice forum - a place where other users would be able to comment and vote for it. If it turns out to be popular, we will consider adding it in one of our future releases.

    Regards,
    Alexander Valchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  5. Dina
    Dina avatar
    50 posts
    Member since:
    Feb 2012

    Posted 17 Jul 2017 in reply to Alexander Valchev Link to this post

    It is very disappointing that 5 years later you still did not implement that. It is very about Telerik. It looks grate but little details like this ruing everything.
  6. Alex Hajigeorgieva
    Admin
    Alex Hajigeorgieva avatar
    1082 posts

    Posted 20 Jul 2017 Link to this post

    Hi Dima,

    I have already responded to you in the ticketing system but I will share my response here in case anyone else comes across this post. I am sorry to hear that you are disappointed with the lack of a custom group sort compare functionality. However, feature implementation in our roadmap and priorities depend largely on the business value and customer demand for specific components and features. We strive to implement functionalities which are in high demand first. We also have a Feature Acceleration Programme separate offering which allows a customer to negotiate a certain component or functionality to be implemented on demand or sooner than our roadmap implies. 

    Currently, the groups are sorted ascending by default in alphabetical order. The sort which is applied to the column headers sorts the group items, not the groups themselves.

    At present, there are two options to achieve the desired custom group sort:

    1) Use server operations and provide the groups as desired:

    http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-serverSorting

    2) If you use client operations, some custom logic will be required.

    - Provide another field which holds the group priority and when grouping occurs, group by that field instead-

    You will need a column template to show the corresponding field value, e.g. days of the week order

    - And a group header template 

    Here is a runnable example with the days of the week:

    http://dojo.telerik.com/UgoyO

    Finally, please take the time to cast a vote in the UserVoice form at:

    http://kendoui-feedback.telerik.com/forums/127393-kendo-ui-feedback/suggestions/16620391-support-custom-sorting-for-datasource-groups

    The most popular ideas are considered for priority implementation.

    Regards,
    Alex Hajigeorgieva
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualisation (charts) and form elements.
  7. Dina
    Dina avatar
    50 posts
    Member since:
    Feb 2012

    Posted 30 Jul 2017 in reply to Alex Hajigeorgieva Link to this post

    Tnks a lot Alex

    Suggested solution works well for me

  8. Andrew
    Andrew avatar
    1 posts
    Member since:
    Oct 2017

    Posted 25 Apr 2018 in reply to Alex Hajigeorgieva Link to this post

    I'm using Kendo MVC 2018 R1 and it appears that I am now able to access the items from the group header template.   I wasn't able to successfully do this in v2017.1.   This allows me to sort by one column (object.ID or SortOrder) and display the corresponding field (object.Description), which is the same for all items in the group.  

     

    .ClientGroupHeaderTemplate(@"#= items[0].Description #")
  9. Alex Hajigeorgieva
    Admin
    Alex Hajigeorgieva avatar
    1082 posts

    Posted 29 Nov 2018 Link to this post

    Hello,

    I am pleased to let you know that thanks to the popularity of this feature request we have now completed it and it will be part of the built-in options as of 2019 R1 which is planned for 16th January 2019.

    Here is the public issue for your reference:

    https://github.com/telerik/kendo-ui-core/issues/4024

    Kind Regards,
    Alex Hajigeorgieva
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  10. Michael
    Michael avatar
    34 posts
    Member since:
    May 2011

    Posted 07 Mar 2019 in reply to Alex Hajigeorgieva Link to this post

    Will the online MVC demos be updated or expanded to show a real example off this - I see nothing under the grid Sorting examples that show how to implement the new capability.
  11. Alex Hajigeorgieva
    Admin
    Alex Hajigeorgieva avatar
    1082 posts

    Posted 11 Mar 2019 Link to this post

    Hello, Michael,

    We have an example in the documentation section at:

    https://docs.telerik.com/aspnet-mvc/api/Kendo.Mvc.UI.Fluent/GridGroupableSortSettingsBuilder

    I have now added an internal task to our backlog as I do believe it is a great idea to have this in the official demos section.

    However, in case you need further assistance with this functionality for the UI for ASP.NET MVC wrappers, please let me know and I can provide you with a runnable example if needed.

    Regards,
    Alex Hajigeorgieva
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  12. Michael
    Michael avatar
    34 posts
    Member since:
    May 2011

    Posted 11 Mar 2019 in reply to Alex Hajigeorgieva Link to this post

    That is super - thanks so much!
  13. Joshua
    Joshua avatar
    1 posts
    Member since:
    Mar 2018

    Posted 08 Oct 2020 Link to this post

    Is this possible for the Jquery/Angular.js version of the grid?
  14. Alex Hajigeorgieva
    Admin
    Alex Hajigeorgieva avatar
    1082 posts

    Posted 09 Oct 2020 Link to this post

    Hello, Joshua,

    For the jQuery Kendo UI Grid, you can use the columns.groupable.sort.compare function and the data source group.compare function.

    Regards,
    Alex Hajigeorgieva
    Progress Telerik

    Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

  15. Marouane
    Marouane avatar
    3 posts
    Member since:
    Mar 2016

    Posted 19 Oct 2020 in reply to Alex Hajigeorgieva Link to this post

    Hi, I have a grid that uses a datasource with group option, combining this with the example you have provided that not work.  

    Here is the example with group definition at the level of the datasource which breaks the group sort defined at the level of the column.

    https://dojo.telerik.com/ULosEbeG/2

    Could you please provide me a working example ?

    Thx

     

     

  16. Marouane
    Marouane avatar
    3 posts
    Member since:
    Mar 2016

    Posted 19 Oct 2020 in reply to Marouane Link to this post

    My bad, you have provided two link, the second one links to how to use sort group with datasource. I will try it.

     

    Thx

Back to Top