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

Template not working

1 Answer 582 Views
Templates
This is a migrated thread and some comments may be shown as answers.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 22 Nov 2011, 01:30 AM
Can you have a quick peek and see if you can detect why this would fail?

http://screencast.com/t/NgirLT9EIErZ

This is the second "template" I'm running after an ajax callback, code I believe is borderline identical...but this one just doesn't seem to run at all and I'm stumped

Can you spot the problem?

success: function (data) {
    var docs = data.d; //Get the data
    var doctemplate = kendo.template($("#dashwidget-document-template").html()); //compile the template
 
    alert(doctemplate);
 
    var result = doctemplate(docs); //Run the template, SILENTLY FAILS HERE...NEVER GETS TO THE ALERT
    alert(result);
 
    $("#document-list").html(result); //display html
},

<div id="document-container">
    <ul id="document-list">
        <li>Loading...</li>
    </ul>
</div>
 
<script id="dashwidget-document-template" type="text/x-kendo-template">
    <li>#= Title #</li>
</script>

1 Answer, 1 is accepted

Sort by
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 22 Nov 2011, 01:41 AM
Edit sorry...wasn't looping the results (duh)

<script id="dashwidget-document-template" type="text/x-kendo-template">
    # for (var i = 0; i < data.length; i++) { #
        <li>#= data[i].Updated #</li>
    # } #
</script>
Tags
Templates
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Share this question
or