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. Image for the cookie policy date

How to embed a rating control inside a custom template field

Hi Support:
I have a custom grid with a column using a template defined like this:


Inside the template we need to embed a rating control.'

I was testing something like this but the rating does not show:


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




For us is important to have the rating inside a template column because we will be rendering the data as follows:

Hotel California☆☆☆☆☆
11111 Pineapple St
Orlando, FL, 161171

Thanks in advanced


3 Replies

SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team January 3, 2017 10:27 AM UTC

Hi David,  
Thanks for contacting Syncfusion Support. 
You can render the control inside the Template Column of the Grid using the TemplateRefresh event. So we suggest to assign the HTML input element for Template and render the ejRating within the TemplateRefresh event of Grid. Refer to the following code example. 
        .Columns(col => 
             . . 
              . . . 
                .Template("<input id='RatingValue{{:OrderID}}' type='text' class='rating' />").Add(); 
            //Based on the OrderID generated Unique ID for each row's rating element 
        .ClientSideEvents(events => events.TemplateRefresh("refreshTemplate")).Render(); 
    function refreshTemplate(args) { 
        if (args.column.headerText == "Rating") 
            $(args.cell).find("#RatingValue" + args.data.OrderID).ejRating({//Rendered ejRating 
                precision: ej.Rating.Precision.Exact, 
                value: args.data.Rating 
Refer to the following Help Document for templateRefresh event of ejGrid. 
Seeni Sakthi Kumar S. 

DS dsapo January 3, 2017 04:37 PM UTC

Thanks Seeni it worked perfectly.



SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team January 4, 2017 04:22 AM UTC

Hi David, 
We are happy to hear that your requirement has been achieved. Get back to us, if you require further assistance on this. 
Seeni Sakthi Kumar S. 

Live Chat Icon For mobile
Up arrow icon