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

Multi sort is not working over objects

2 Answers 100 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Petar
Top achievements
Rank 1
Petar asked on 16 Oct 2017, 07:29 AM

Hello everyone,

the wanted behavior is that I want to sort 3 columns with multi sort functionality of the grid, but the problem is that two of my columns are build from objects and the multi sort is not working over them. 

This is the example https://jsfiddle.net/x3Lqn2h3/

So, try first to sort over "age" descending (it works) after that try to sort over "name" (it works) and finally sort over "address" (it does not work). When you click over address the values "Pernik" and "Silistra" should swap their places but they don't.

 

Thank you for your help in advance!

2 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 18 Oct 2017, 06:37 AM
Hi Petar,

Thank you for the provided sample. I have examined it and noticed that in the compare functions, the case when values are equal is missing. In other words, when comparing Ivan with Ivan will return -1, which is not true. 

I have modified the provided sample o include the case when compared values are equal:



Regards,
Georgi
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Petar
Top achievements
Rank 1
answered on 18 Oct 2017, 06:43 AM

Hi Georgi,

thank you for your help indeed I missed that and now it is working as expected.

Regards,
Petar

Tags
Grid
Asked by
Petar
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Petar
Top achievements
Rank 1
Share this question
or