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

Column Sort by Different Value

2 Answers 390 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dustin
Top achievements
Rank 2
Iron
Iron
Dustin asked on 18 Dec 2019, 10:26 PM

Is there any way to sort a column by a different value than what is shown in the grid?  I have a grid that lists blobs and their file sizes as a string to include KB, MB, and so on.  I'd like to be able to sort the column based on file size, but with the data being a string it doesn't sort correctly.  I'd like to have the value represented as an int in bytes, but continue to display the column as a string.  Is this possible?

 

Thanks in advance!!

2 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 19 Dec 2019, 02:23 PM

Hi Dustin, 

You can use a cell template for this The Field of the column will point to the Size field that you want to sort by, but in the template you will render the string you want your users to see.

You can find an example of this here: https://feedback.telerik.com/blazor/1427060-adding-sortfield-to-grid. While this feature implementation has been declined at the moment because it is doable with a template, you can comment and vote on it and if it gains sufficient traction with the community, we could reopen it.

 

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor
0
Dustin
Top achievements
Rank 2
Iron
Iron
answered on 19 Dec 2019, 03:39 PM
I really appreciate how quick you respond to posts!  Thank you for the reference!
Tags
Grid
Asked by
Dustin
Top achievements
Rank 2
Iron
Iron
Answers by
Marin Bratanov
Telerik team
Dustin
Top achievements
Rank 2
Iron
Iron
Share this question
or