Multi sort is not working over objects

3 posts, 0 answers
  1. Petar
    Petar avatar
    5 posts
    Member since:
    Oct 2017

    Posted 16 Oct 2017 Link to this post

    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. Georgi
    Admin
    Georgi avatar
    574 posts

    Posted 18 Oct 2017 Link to this post

    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.
  3. Petar
    Petar avatar
    5 posts
    Member since:
    Oct 2017

    Posted 18 Oct 2017 Link to this post

    Hi Georgi,

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

    Regards,
    Petar

Back to Top