I have a EJ2 Grid. I defined a Caption Template. I am trying to call a Javascript function but it is failing because the ${key} is a string with spaces. I ran an inspect (see the image) and the call fails do to the spaces. I tried to add quotes but those do not work either. Is there some trick to get this value to the JS function?
<script id="captiontemplate" type="text/x-template">
${if(field === "DistrictTypeName")}
<strong>District Type:</strong> ${key}
${/if}
${if(field === "DistrictName")}
<table>
<tr>
<td style="width:500px">
<strong>District:</strong> ${key}
</td>
<td style="width:200px">
<i onclick="javascript:ShowEditDistrictModal(${key}, 1)" class="viewIcon" title="View" />
<i class="fa fa-1x fa-eye"></i>
</td>
<td style="width:200px">
<i onclick="javascript:ShowEditDistrictModal(${key}, 0)" class="editIcon" title="Edit" />
<i class="fa fa-1x fa-edit"></i>
</td>
</tr>
</table>
${/if}
</script>