Grid sort .Groupable() descending by default

1 Answer 33 Views
Grid
Matt
Top achievements
Rank 1
Matt asked on 15 Jul 2021, 11:48 PM
when I use .Groupable() in my grid it sorts the column that I have set to be grouped ascending by default. are there some parameters I can pass through to have it sort descending by default? Column names are variable so I cannot specify a by column name.

1 Answer, 1 is accepted

Sort by
0
Anton Mironov
Telerik team
answered on 20 Jul 2021, 02:09 PM

Hello Matt,

Thank you for the image and details provided.

I am not totally sure about the "default" requirement task:

  • If you need to sort a field from your Kendo UI Grid programmatically in descending order, I would recommend using the approach from the following article:
    https://docs.telerik.com/kendo-ui/api/javascript/data/datasource/configuration/sort

  • If clicking on the column has to sort first in descending order could only be handled with a custom implementation. Handle the click of a "th" element and implement your custom sorting to the Grid.

I hope this information helps.

Kind Regards,
Anton Mironov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Matt
Top achievements
Rank 1
commented on 23 Jul 2021, 02:05 AM

This is not at all what I asked to do.
Anton Mironov
Telerik team
commented on 27 Jul 2021, 12:55 PM

Hi Matt,

Could you please share more details about the expected behavior?

In my previous reply, I was asking for more details. Once I have further information will try my best to achieve the needed result.

Looking forward to hearing back from you.

Best Regards,
Anton Mironov

Matt
Top achievements
Rank 1
commented on 27 Jul 2021, 05:23 PM

Not sure how I can make it more clear. When I drag a column to be grouped it sorts it ascending by default. I want it to sort descending by default.
Eyup
Telerik team
commented on 30 Jul 2021, 01:57 PM

Hi Matt,

This requirement is supproted and you can achieve it using the following approach:

groupable.Sort(sort => sort.Dir(ListSortDirection.Descending))
The full snippet you can see here:
https://docs.telerik.com/aspnet-mvc/api/Kendo.Mvc.UI.Fluent/GridBoundColumnGroupableSortBuilder#dirsystemcomponentmodellistsortdirection
Feel free to give it a try and let me know if it helps you.

Tags
Grid
Asked by
Matt
Top achievements
Rank 1
Answers by
Anton Mironov
Telerik team
Share this question
or