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

How do I change the sorting function used in the spreadsheet's Sort Filter?

3 Answers 226 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Clint
Top achievements
Rank 1
Clint asked on 28 Jul 2020, 04:39 AM

Hello, I am referring to the Filters section of https://docs.telerik.com/kendo-ui/controls/data-management/spreadsheet/end-user/user-guide

that describes the Sort fields spreadsheet function ("Sort range A to Z" and "Sort range Z to A" options appears when you click the filter button on the top of a column.

I would like to know how to change the javascript sorting function used for each of these options (it seems to be described on page https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/configuration/columns.sortable in the "EXAMPLE - DEFINE CUSTOM COMPARE FUNCTION" section, but I am having difficulty getting this to work).

Thank you!

3 Answers, 1 is accepted

Sort by
0
Aleksandar
Telerik team
answered on 29 Jul 2020, 02:37 PM

Hello Clint,

The current implementation of the Spreadsheet does not provide an API configuration option that would allow you to define a custom compare function similar to the one cited for the Kendo Grid

The Spreadsheet API provides a sheets.sort configuration option that allows you to set the sort order for columns. Note that, however, there is a known issue concerning this option, so if you need to sort the columns it is currently suggested to use the range.sort() method

Here is a sample dojo demonstrating how to sort the ID column in descending order.

I hope this helps.

Regards,
Aleksandar
Progress Telerik

0
Clint
Top achievements
Rank 1
answered on 11 Aug 2020, 08:04 PM
Thank you for your help Aleksandar.  I am trying to adjust data sent to the spreadsheet to work as expected with the column sorting.  Appreciate your help!
0
Aleksandar
Telerik team
answered on 13 Aug 2020, 01:53 PM

Hello Clint,

When using the range.sort() method the values for the particular range would be sorted according to the provided parameters. If you would like to display the filters use the filter() method.

Here is a runnable example.

Regards,
Aleksandar
Progress Telerik

Tags
Spreadsheet
Asked by
Clint
Top achievements
Rank 1
Answers by
Aleksandar
Telerik team
Clint
Top achievements
Rank 1
Share this question
or