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

sorting on cell value

1 Answer 58 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
tom
Top achievements
Rank 1
tom asked on 07 Jan 2021, 03:52 PM

Hi,

I have a grid where column A takes the size of an array and, depending on if the status in column B is right, outputs the array's length. If the status is not right, the output is a -. When I sort, the underlying value from the field is sorted, whereas I want the cell's value to be sorted. The column may look like this:

5

3

-

6

-

4

and I would want it to sort to 

6

5

4

3

-

-

 

Currently it sorts to because the underlying value of the - is 6 and 4

6

-

5

4

-

3

 

Is there any way to sort by the cell and not the field? 

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 08 Jan 2021, 07:02 AM

Hello, Tom,

There are some options in this case as the sorting is done outside of the Grid:

1) Process the data and create a new field that will hold values that will be the same as the display values. Then when sorting, instead of sorting by the column A value, sort by that field. The issue with that approach is that the visual indication will be missing.

2) The sorting logic can be modified once this feature is available:

https://github.com/telerik/kendo-react/issues/819

3) Use custom sorting on the client or on the server that will sort the data based on the application requirement.

Regards,
Stefan
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
General Discussions
Asked by
tom
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or