Sorting in invalid state

4 posts, 0 answers
  1. Ján
    Ján avatar
    18 posts
    Member since:
    Jun 2017

    Posted 04 Aug 2017 Link to this post

    Hello,

    we use Kendo Ui for ANgualr 2 grid with sorting. Out of the box the column with sorting enabled can be in 3 possible states: sorted asc, sorted desc or not sorted. chages in grid sorting update boutd sort property wit current array of SortDescriptors. When column is sorted  SortDescriptor is added to array of Sortdescriptors and specifies the field and direction of sort.

    If column is not sorted it should not be present in SortDescriptor array. However if column is clicked until it is unsorted again, its SortDesriptor stays in array with direction 'undefined'. This is incorrect, it should disappear from array. Also according to Kendo type definition direction can only have value 'asc' or 'desc' but not 'undefined' 

  2. Dimiter Topalov
    Admin
    Dimiter Topalov avatar
    1297 posts

    Posted 08 Aug 2017 Link to this post

    Hello Ján,

    Thank you for the detailed feedback.

    The described behavior is by design, and the reasoning behind is that when unsorting (returning to the initial ordering of the data collection is bound to) is allowed (this can be controlled via the allowUnsort sort setting), the sorted data needs to be returned to the initial state (unsorted), and this is why we provided an opportunity for the developer to get notified that the data should be unsorted by some column.

    However, you are making a valid point, and we will discuss how to best handle the issue - whether by changing the current behavior, or by changing the type definition of the SortDescriptor to allow other values than 'asc' and 'desc' for the dir property.

    Regards,
    Dimiter Topalov
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Ján
    Ján avatar
    18 posts
    Member since:
    Jun 2017

    Posted 09 Aug 2017 in reply to Dimiter Topalov Link to this post

    i believe that the opportunity for the the developer to get notified that the data is unsorted is implicit in sort state - if the column has a sort descriptor it is sorted according to it, if it does not have a sort descriptor its unsorted - and sort state information is allays passed in as sortChange event argument. Otherwise also initial sort state should include sort descriptor for all columns with undefined direction.

  4. Dimiter Topalov
    Admin
    Dimiter Topalov avatar
    1297 posts

    Posted 11 Aug 2017 Link to this post

    Hello Ján,

    You are presenting valid arguments, so I have logged an issue in our public repository that you can track here:

    https://github.com/telerik/kendo-angular/issues/818

    You can expect either a fix, or an explanation about the motivation behind the current behavior from our developers, responsible for the Grid package.

    Regards,
    Dimiter Topalov
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top