External template being rendered into page?!?

7 posts, 1 answers
  1. Lisa
    Lisa avatar
    20 posts
    Member since:
    Feb 2014

    Posted 08 May 2014 Link to this post

    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!
  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2877 posts

    Posted 12 May 2014 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. Lisa
    Lisa avatar
    20 posts
    Member since:
    Feb 2014

    Posted 15 May 2014 in reply to Alexander Valchev Link to this post

    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!
  5. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2877 posts

    Posted 16 May 2014 Link to this post

    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!
     
  6. Lisa
    Lisa avatar
    20 posts
    Member since:
    Feb 2014

    Posted 16 May 2014 Link to this post

    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!
  7. Lisa
    Lisa avatar
    20 posts
    Member since:
    Feb 2014

    Posted 16 May 2014 in reply to Lisa Link to this post

    BTW, is there a way to delete snippets from the Kendo UI Dojo?
  8. Answer
    Alexander Valchev
    Admin
    Alexander Valchev avatar
    2877 posts

    Posted 19 May 2014 Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready