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
close icon

How do you make a column template generic for use with more than one column in an ejGrid?

I have a grid bound to a data source that could have 20 columns with the same data type. I would like them all to be formatted the same way. Can you use a generic column template that could be apply separately to each field?

I would like to be able to do something like:

...
columns
[
{ field: 'Field1', columnTemplate: true, templateId: "#fieldTemplate" }
{ field: 'Field2', columnTemplate: true, templateId: "#fieldTemplate" }
{ field: 'Field3', columnTemplate: true, templateId: "#fieldTemplate" }
]
...

and then in the template, reference the field, something like:

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

       <img src="images/{{:WHAT DO I PUT HERE?}}.png"  />

</script>


I do not have to repeat this script block for each different field, do I?

I found this post (http://www.syncfusion.com/forums/116069/example-documentation-on-how-to-use-a-column-template) but the suggested solution will not work for me because I need the fields to be in individual columns.

Thanks


3 Replies

IR Isuriya Rajan Syncfusion Team August 10, 2015 10:22 AM UTC

 Hi Scott,

 We considered this “Column details at column template” as an improvement issue and a support incident has been created under your account to track the status

of this requirement. Please log on to our support website to check for further updates.
 

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

 

As of now, this issue can be handled by using the following workaround solution. We should give separate column template script for each template.
 

Please let us know if you require further assistance on this.

Regards,

Isuriya R




SB Scott Belina August 12, 2015 01:40 AM UTC

Thanks


IR Isuriya Rajan Syncfusion Team August 12, 2015 06:04 AM UTC

Hi Scott,

Thanks for your patience.

Please let us know if you require further assistance on this.We are happy to assist you.
Regards,

Isuriya R.

Loader.
Live Chat Icon For mobile
Up arrow icon