We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

is it possible to sort column by a foreign key?

Thread ID:





130084 Apr 20,2017 01:47 PM UTC Apr 21,2017 08:32 AM UTC JavaScript 1
Tags: ejGrid
Asked On April 20, 2017 01:47 PM UTC

I have a table, which contain rows with dropdowns (foreignKeyField - value, foreignKeyValue - text). When i'm trying to sort column, it became sorted by foreignKeyField (id), not by a foreignKeyValue(text in cell). Is there a way to sort columns by a foreignKeyValue? 

Jayaprakash Kamaraj [Syncfusion]
Replied On April 21, 2017 08:32 AM UTC

Hi Justpsst,

Thanks for contacting Syncfusion support.  

We have analyzed your query and we suggest you to use ForeignKeyAdaptor to sort a foreign key column based on the displayed values. ForeignKeyAdaptor supports only on local data binding. Please refer to the below code example and sample. 

  <script type="text/javascript"> 
        $(function () { 
                     var obj = {dataSource: window.employeeView, foreignKeyField: "EmployeeID", foreignKeyValue: "FirstName"}; 
                     var arr = []; 
            var data = window.gridData; 
                dataSource: ej.DataManager({ json:data, adaptor: new ej.ForiegnKeyAdaptor(arr,"JsonAdaptor")}), 
                allowPaging: true, 
                allowSorting: true, 
                columns: [ 
                        { field: "OrderID", width: 80, textAlign: ej.TextAlign.Right,validationRules: {required:true, number: true },headerText: "Order ID"} , 
                        { field: "FirstName", width: 75, headerText: "First Name” }, 


Jayaprakash K. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon