This is a migrated thread and some comments may be shown as answers.
Multiple columns sorting issue
1 Answer 27 Views
This is a migrated thread and some comments may be shown as answers.
Maryia
Top achievements
Rank 1
Maryia asked on 13 Sep 2018, 07:57 PM
Example: https://dojo.telerik.com/eVudUCoq/4

I am applying sort to 3 different columns: 
range.sort([{column: 3, ascending: true}, {column: 4, ascending: true}, {column: 5, ascending: true}]);

You can see that CLIENT column is not sorted properly ('Alexandra Kennedy' is located at 12th row but should be at the top);
Seems to happen when I have more than 2 columns for sort.

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 17 Sep 2018, 11:54 AM
Hello Mariya,

The Kendo UI Spreadsheet's range.sort() method sorts column values based on the index. For example, when three column sort objects are passed to the function, the second column will be sorted based on the first column indexes, and the third column will be sorted based on the first and second column indexes. This is described in the API reference:


The built-in sort behavior of the Spreadsheet works differently than the one provided by Excel, where the functionality works based on a 'then-by' principle. I would encourage you to log this as a new feature request in the Kendo UI Feedback Portal. This way, the rest of the community will be able to discuss and vote for this feature. Based on the demand and gathered feedback, this could be scheduled for implementation in a future release.

As a workaround for the current scenario, I would suggest first sorting the data on the server and then using the fromJSON() method to load the data into the Spreadsheet. You could refer to the following demo, where the mentioned method is used to retrieve the data from a remote end-point and then bind it to the widget:


Regards,
Dimitar
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.
Asked by
Maryia
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or