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

External template being rendered into page?!?

6 Answers 106 Views
Templates
This is a migrated thread and some comments may be shown as answers.
Lisa
Top achievements
Rank 1
Lisa asked on 08 May 2014, 08:31 PM
This is driving me nuts.  I have a simple list view bound to some external json data.  The list view uses an external template.  It's working fine.  However, the raw template is also rendering to the HTML in the page.  WHY?!?!

<div id="listView"></div>
 
<script  type="text/x-kendo-template" id="template">
     Category name: #=categoryName#, GL Code : #=glCode#<br><br>
</script>
 
<script>
    $(function() {
 
        var dataSource = new kendo.data.DataSource({
            transport: {
                read: {
                    url: "@routes.Assets.at("data/glcodes.json")" ,
                    dataType: "json"
                }
            }
        });
 
        $("#listView").kendoListView({
            dataSource: dataSource,
            template: kendo.template($("#template").html())
        });
 
    });
</script>

The rendered output:

Category name: One, GL Code : 11111
Category name: Two, GL Code : 22222
Category name: Three, GL Code : 33333
Category name: Four, GL Code : 44444
Category name: Five, GL Code : 55555
Category name: Six, GL Code : 66666
Category name: Seven, GL Code : 77777
Category name: Eight, GL Code : 88888
 
Category name: #=categoryName#, GL Code : #=glCode#<br><br>

Thanks in advance!

6 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 12 May 2014, 09:16 AM
Hi Salvador,

I tried to reproduce the behaviour in a sample page but to no avail. Could you please check it and let me know what I am missing?
Which browser you are testing with?

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Lisa
Top achievements
Rank 1
answered on 15 May 2014, 07:17 PM
Hi Alexander,

I don't find any code when I click through your link...  But anyway, though I still don't know WHY it's a problem, I do know that changing the template ID from "template" to say "templateList" where it's defined and used solves the problem.  I can't find any other elements conflicting with that name in my simple page.  But at least I have a workaround.

Thank you!
0
Alexander Valchev
Telerik team
answered on 16 May 2014, 07:14 AM
Hi Salvador,

It seems that the code snippet which I provided was not saved correctly. Please accept my apology for the inconvenience.
You should be able to see it using this link: http://trykendoui.telerik.com/eRoP

We are not sure what exactly causes the issue with the template ID on your side. Can you reproduce the same problem in my sample page?

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Lisa
Top achievements
Rank 1
answered on 16 May 2014, 10:10 PM
I found the problem.  In an stylesheet that was provided by the graphic artist, there was a style for:

#template {
    display: block;
}

So when the template had the id "template", it matched and was displayed. 

Thanks for your help!
0
Lisa
Top achievements
Rank 1
answered on 16 May 2014, 10:14 PM
BTW, is there a way to delete snippets from the Kendo UI Dojo?
0
Accepted
Alexander Valchev
Telerik team
answered on 19 May 2014, 08:28 AM
Hello Salvador,

I am glad to hear that you managed to resolve the issue with the displayed template. Regarding your second question, deleting snippets functionality is currently in development. Probably it will be available till the end of this week or at the beginning of the next one.

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