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

Sorting of a column that uses a custom template

Thread ID:





116867 Jun 23,2014 03:39 PM UTC Jun 26,2014 04:51 AM UTC JavaScript 3
Tags: ejGrid
Asked On June 23, 2014 03:39 PM UTC

When using a custom template for a column such as this one

<script type="text/x-jsrender" id="colourTemplate">
    {{if Colour && Colour.Name}}
        <div class="colour-preview" style="background-color: {{:Colour.Hex }};"></div>

How can the sorting of the column be updated so that they are ordered by the 'Name' property? 

does it require adding some comparer function to the Colour object? 

or defining a function to use similar to how you can define custom functions when doing an array sort?

Ragavee U S [Syncfusion]
Replied On June 24, 2014 01:05 PM UTC

Hi Neil


We have analyzed your requirement for performing sorting operation in the customTemplate column. As per the behavior, we should not perform filtering, sorting, editing and grouping in Unbound columns. To perform such operations the column must be bound to the grid datasource.


Also the sorting operation is performed based on the field property of the column. So if you want to perform sorting to the customTemplate column based on the Name property, please refer the below code snippet.


<script type="text/x-jsrender" id="columnTemplate">

    {{if Color && Color.Name}}

        <div style="height:20px;background-color: {{:Color.Hex }};"></div>







columns: [                                            

         { field: "Color.Name", headerText: 'Template Column', textAlign: ej.textAlign.Left, width: 100,columnTemplate: true, templateId: "#columnTemplate"},

. . .]

. . .



For your convenience, we have created a simple sample for performing sorting operation on customTemplate column. The sample can be downloaded from the attachment.


Please let us know if you need any further assistance.



Ragavee U S

Attachment: Sample_75af1282.zip

Replied On June 25, 2014 02:27 PM UTC

Thank you that worked.

Madhu Sudhanan P [Syncfusion]
Replied On June 26, 2014 04:51 AM UTC

Hi Neil,

Thanks for your update. Please get back to us if you require further assistance. We will be happy to help you out.

Madhu Sudhanan. P


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