Grid column template

Hello,

I am trying to use Grid column template, but I can not make it work correctly.

I am trying to migrate from Essential JS1 to Essential JS2. In Essential JS1 I was using template with type="text/x-jsrender", but it seems that it is not working with Essential JS2.

I am trying to set template like this:
my.component.html file:

my.component.ts file:

index.html file:

I am getting result like this:


What am I doing wrong? How I need to set template using template id in Essential JS2 version?




3 Replies

VA Venkatesh Ayothi Raman Syncfusion Team March 15, 2018 01:09 PM UTC

Hi Customer, 

Thanks for using Syncfusion products. 

We went through your code example that you have shared for us and found that you are using JSrender Syntax. But in EJ2 control has built-in template engine which provides options to compile template string into a executable function instead of JSrender. Please refer to the following Help documentation for more information, 
Please refer to the following code example for your convenience, 
<script id="template" type="text/x-template"> 
    ${if(PictureFileContent)} 
    <img src='data:png;base64,${PictureFileContent}'>${ReportName} 
    ${else} 
    ${ReportName} 
    ${/if} 
</script> 
 
Note: If we use Angular component with template then we suggest you to use ng-template for template column. This is the recommended way. Please refer to the following online demo, 
 
Please let us know if you have any further assistance on this. 
 
Regards, 
Venkatesh Ayothiraman. 



UN Unknown Syncfusion Team March 20, 2018 09:47 AM UTC

Thank you very much! It was very helpful!


VA Venkatesh Ayothi Raman Syncfusion Team March 21, 2018 04:06 AM UTC

Hi Customer, 

Thanks for the feedback. 

We are very happy to hear that your requirement is achieved. 

Regards, 
Venkatesh Ayothiraman. 


Loader.
Up arrow icon