This is a migrated thread and some comments may be shown as answers.
Sorting in invalid state
3 Answers 14 Views
This is a migrated thread and some comments may be shown as answers.
Ján
Top achievements
Rank 1
Ján asked on 04 Aug 2017, 03:48 PM

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' 

3 Answers, 1 is accepted

Sort by
0
Dimiter Topalov
Telerik team
answered on 08 Aug 2017, 11:54 AM
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.
0
Ján
Top achievements
Rank 1
answered on 09 Aug 2017, 08:35 AM

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.

0
Dimiter Topalov
Telerik team
answered on 11 Aug 2017, 10:34 AM
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.
Tags
Grid
Asked by
Ján
Top achievements
Rank 1
Answers by
Dimiter Topalov
Telerik team
Ján
Top achievements
Rank 1
Share this question
or