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.
Unfortunately, activation email could not send to your email. Please try again.

is it possible to sort column by a foreign key?

Thread ID:

Created:

Updated:

Platform:

Replies:

130084 Apr 20,2017 09:47 AM Apr 21,2017 04:32 AM JavaScript 1
loading
Tags: ejGrid
justpsst
Asked On April 20, 2017 09:47 AM

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 04:32 AM

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 = []; 
                     arr.push(obj); 
            var data = window.gridData; 
            $("#Grid").ejGrid({ 
                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” }, 
                ] 
            }); 
        }); 
 
    </script> 


Regards, 

Jayaprakash K. 
 


CONFIRMATION

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.

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.

;