This is a migrated thread and some comments may be shown as answers.

Grid Column Template with SVG image

1 Answer 732 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rebecca
Top achievements
Rank 1
Rebecca asked on 17 Mar 2015, 01:18 PM
I'm having trouble using an SVG image in a column template.

I have my data-column set up to use a column template:
{'field': 'importantNote', 'title': 'Critical', 'template': $('#criticalTemplate').html() }


then I have my template script:
<script id="criticalTemplate" type="text/x-kendo/template"><br>    #if(data.importantNote=== 'Y'){#<br>    <svg class="grid-icon"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-warning2"></use></svg><br>    #}else{#<br>    #}#<br></script>


I believe xlink:href="#icon-warning2" is causing the problem - if I remove this portion, then the template doesn't error. I've tried escaping the # like this: xlink:href="\\#icon-warning2" but it doesn't work. I know for sure that my SVG reference is working because the graphic shows if I put in anywhere else on the page.

Any insights on how to fix this?

1 Answer, 1 is accepted

Sort by
1
Rebecca
Top achievements
Rank 1
answered on 17 Mar 2015, 03:29 PM
Never mind - it's now working by escaping the # hash tag.

<script id="criticalTemplate" type="text/x-kendo/template"><br>    #if(data.criticalNoteFlag === 'Y'){#<br>    <svg class="grid-icon"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="\\#icon-warning2"></use></svg><br>    #}else{#<br>    #}#<br></script>
Tags
Grid
Asked by
Rebecca
Top achievements
Rank 1
Answers by
Rebecca
Top achievements
Rank 1
Share this question
or