Articles in this section
Category / Section

How to enable non case sensitive Grid sorting?

1 min read

Usually while sorting is performed, first preference is given to capital letters and then small letters. When you don’t want the discrimination between small and capital letters, you can set enableLocalizedSort API as true to sort both small and capital letters.


In the following example, enableLocalizedSort is set as true in order to sort the column using non case and culture sensitive comparer function. The enableLocalizedSort API is used to perform localized sort operation.

The enabledLocalizedSort API to be set as true within the script tag for all the platforms as in the below snippet.

<script type="text/javascript">
    $(function () {// Document is ready. = true

Grid rendering code


<div id="Grid"></div>
<script type="text/javascript">
    $(function () {// Document is ready.
            dataSource: window.gridData,
            allowSorting: true,
            sortSettings: { sortedColumns: [{ field: "CustomerID", direction: ej.sortOrder.Ascending }]},
            allowPaging: true
            columns: [
                                      { field: "OrderID", headerText: "Order ID", isPrimaryKey: true, textAlign: ej.TextAlign.Right, width: 100 },
                                      { field: "CustomerID", headerText: "Customer ID", width: 130 },
                                      { field: "Freight", headerText: "Freight", textAlign: ej.TextAlign.Right, width: 100, format: "{0:C}" },
                                      { field: "ShipCountry", headerText: "ShipCountry", width: 100 }


[In View]
      .SortSettings(sort => sort.SortedColumns(col => col.Field("CustomerID").Direction(SortOrder.Ascending).Add()))
      .Columns(col =>
            col.Field("OrderID").HeaderText("Order ID").Width(75).Add();
            col.Field("CustomerID").HeaderText("Customer ID").Width(110).Add();
            col.Field("ShipCountry").HeaderText("Ship Country").Width(110).Add();


<ej:Grid ID="OrdersGrid" runat="server" AllowPaging="True" AllowSorting="True"> 
            <SortedColumns><ej:SortedColumn Field="CustomerID" Direction="Ascending" /></SortedColumns>    
                <ej:Column Field="OrderID" HeaderText="Order ID" IsPrimaryKey="True" />                
                <ej:Column Field="EmployeeID" HeaderText="Employee ID" />
                <ej:Column Field="Freight" HeaderText="Freight" Format="{0:C}" />                
                <ej:Column Field="ShipCity" HeaderText="Ship City" />

The following screenshot illustrates the output.


 Localized sort operation

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment