AGuyCalledGerald
AGuyCalledGerald

Reputation: 8150

Render kendo grid inside template results in error

I use an external kendo template. I want to render a grid inside the template.

<script type="text/x-kendo-template" id="template">

<div id="grid"
     data-role="grid"
     data-columns="[
        { 'field': 'Name', 'attributes': { 'title': '#=Description#' } }
     ]"    
     data-bind="source: Items">
</div>

</script>

This works as long as I omit the '#'. If I include '#' (in the example for the title attribute), it results in an a invalid template error.

Upvotes: 1

Views: 349

Answers (1)

DontVoteMeDown
DontVoteMeDown

Reputation: 21465

You have to escape the # or the template engine will try to evaluate that statement. As showed in this doc you can try these escaping methods:

{ 'title': '\\\\#=Description\\\\#' }

or

{ 'title': '\\#=Description\\#' }

Upvotes: 2

Related Questions