Declined
Last Updated: 10 Mar 2021 09:29 by ADMIN
Sergiu
Created on: 02 Jul 2013 09:21
Category: Kendo UI for jQuery
Type: Feature Request
19
Grid: sorting ForeignKey column
When sorting a foreign key column on grid, the sorting is performed using the value/id - which is wrong. The sorting should consider the text displayed to the user.
14 comments
ADMIN
Aleksandar
Posted on: 10 Mar 2021 09:29

Hi Jonathan,

We have an article demonstrating how you can enable the sort-by-text functionality in a ForeignKey column in the Grid:

https://docs.telerik.com/kendo-ui/knowledge-base/foreign-key-column-sorting-by-text

I hope this helps.

Regards,
Aleksandar
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/.

Jonathan
Posted on: 03 Mar 2021 17:11
Please implement this functionality. It just makes sense, I run into this problem all the time.
Imported User
Posted on: 14 Dec 2016 01:15
What a ridiculous response. I'm dumbfounded that Telerik implemented sorting on ForeignKeys like this. These kind of issues are showstoppers.
Leo
Posted on: 05 Jun 2016 12:39
Shocked that this is not supported. As a workaround i use this:

    public static class DataSourceRequestExtensions
    {
        public static void ReplaceSortColumn(this DataSourceRequest instance, string from, string to)
        {
            instance.Sorts.Where(w => w.Member == from).ToList().ForEach(s => s.Member = to);
        }
    }

useage:

        public ActionResult Entity_Read([DataSourceRequest]DataSourceRequest request)
        {
            request.ReplaceSortColumn("idColumn", "entity.text");
Deepak
Posted on: 25 Apr 2016 16:26
@CrazyTalk - Are you also filtering the same column and passing the list to filter drop down?
Deepak
Posted on: 22 Apr 2016 22:10
Is this fixed or supported in the latest version of Kendo?
Imported User
Posted on: 02 Dec 2015 16:53
crazytalk, could you copy and paste the piece of code where you doing this please?
Thanks ¡¡¡¡¡¡
Imported User
Posted on: 18 Nov 2015 05:11
As a workaround in my MVC.Net code I pass the text field concatenated with the id separated by a hyphen (Text+"-"+Id) to the kendo control
which means sorting by the id gives the correct order because the id starts with the text and is unique because it end in the unique id. when I pass the data back to the MVC application I separate the ID using a substring for the last instance of hyphen which works fine if your id’s are numeric
Imported User
Posted on: 11 Feb 2015 13:43
Who in the world would want to sort Column displayed as Text by the Id? Just say it is not implemented :)
ADMIN
Telerik Admin
Posted on: 17 Jan 2014 17:37
A possible workaround might be to include a hidden column in the grid with field matching the value field of the foreign key column. Then when attempting to sort the foreign key column, consider cancelling the default sort and manually sorting by the value field invoking the sort method of the data source (http://docs.kendoui.com/api/framework/datasource#methods-sort).

As Atanas explained, built-in support for sorting in this case cannot be implemented for all scenarios.
FA
Posted on: 13 Jan 2014 15:47
Any update on this issue?
P.
Posted on: 19 Dec 2013 00:36
Hello,

I would just like to check with you if this is the final decision taken by Telerik (not to support this feature)? We have Kendo subscription in my organization and I use Kendo UI (in one of the projects - business, data driven web application) in combination with several odata web services (already implemented and deployed to the internal network), so if there's no possibility of within-grid data sorting by foreign key column value, which seems to be a regular requirement in any enterprise application, it brings the usage of the whole Kendo UI library in combination with odata web services under the question mark.

Thanks in advance.
Sergiu
Posted on: 10 Oct 2013 08:47
If it has only key, use the key on sorting, but if it has a value also, sort using value instead of key.
Jark Monster
Posted on: 22 Aug 2013 14:37
Did this get logged as a bug, and is there any status update on it?