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

4 posts, 0 answers
  1. Clint
    Clint avatar
    4 posts
    Member since:
    Apr 2020

    Posted 27 Jul 2020 Link to this post

    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!

  2. Aleksandar
    Admin
    Aleksandar avatar
    286 posts

    Posted 29 Jul 2020 Link to this post

    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

  3. Clint
    Clint avatar
    4 posts
    Member since:
    Apr 2020

    Posted 11 Aug 2020 in reply to Aleksandar Link to this post

    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!
  4. Aleksandar
    Admin
    Aleksandar avatar
    286 posts

    Posted 13 Aug 2020 Link to this post

    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

Back to Top