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

Kendo Template error - cannot call method "replace" of undefined

1 Answer 1642 Views
Templates
This is a migrated thread and some comments may be shown as answers.
AP
Top achievements
Rank 1
AP asked on 11 Jan 2013, 07:29 AM
Hello, 

I have a template defined as:
<script id="roiTemplate" type="text/x-kendo-template">
        <div id="roi" class="span2 offset1 kpi">
            <p>#=title#</p>
            <input type="text" data-width="100" value="#=value#" class="dial" data-readOnly="true"/>
        </div>
</script>

And here I'm invoking the template and providing it data:
var getTemplate = kendo.template($('#roi').html());
var data = { value : "50", title: "ROI"};
$('#campaign-metrics').append(getTemplate(data));

When I load this page, I get the error "Uncaught TypeError: Cannot call method 'replace' of undefined" kendo.all.js at line 252." What am I doing wrong?

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 11 Jan 2013, 08:39 AM
Hello,

 The id of your template is "roiTemplate" yet you call $("#roi") which probably returns nothing. Fix the id of your template.

Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Templates
Asked by
AP
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or