Group by column in descending order by default

3 posts, 0 answers
  1. Yih Wern
    Yih Wern avatar
    5 posts
    Member since:
    Jun 2020

    Posted 14 Oct 2020 Link to this post

    Hi Everyone,

    I am trying to set the Kendo Grid with Group by specific column by default, so I have used the code snippet as shown below:

    @(Html.Kendo().Grid<StudentRecord>().Name("Grid")

    .Groupable()

    .Sortable()

    .GroupPaging(true)

    .Group(x => x.Add(y => y.StartYear))

     

    And I realised it always displays the StartYear groups in ascending order by default.

    Please advise how I could set the StartYear groups to sort in descending order by default.

    Thank you.

  2. Plamen
    Admin
    Plamen avatar
    3079 posts

    Posted 19 Oct 2020 Link to this post

    Hello,

    You can try setting the Sort of the Groupable method:

     .Groupable(g=>g
        .Sort(e=>e.Dir(System.ComponentModel.ListSortDirection.Descending)
        ))

    Regards,
    Plamen
    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).

  3. Yih Wern
    Yih Wern avatar
    5 posts
    Member since:
    Jun 2020

    Posted 28 Oct 2020 in reply to Plamen Link to this post

    Hi Plamen,

    Appreciate your response and I have tried, but it did not work as expected.

    My requirement is to sort by the StudentYear, and I managed to find the solution from this post:

    https://www.telerik.com/forums/chaning-group-default-sort

    Thanks and regards

Back to Top