How do I run content into a Kendo client-side layout by putting the layout and content into <script> tags

2 posts, 0 answers
  1. AppsWiz
    AppsWiz avatar
    15 posts
    Member since:
    Apr 2013

    Posted 09 Dec 2015 Link to this post

    I want to do this, which is a way to run content into a Kendo client side template:

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

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

    content here

    </script>

     

    How does the content get assinged to the template? I have no placeholder within the layout template for the content to be run into therefore it isn't displaying

  2. Magdalena
    Admin
    Magdalena avatar
    421 posts

    Posted 10 Dec 2015 Link to this post

    Hello Dennis,

    It is possible to add the content to the template by a custom additional JavaScript by the follwing:
    <script type="text/x-kendo-template" id="layout-template">
        layout template here
        #= renderappDetailsTemplate(data) #
    </script>
     
    <script type="text/x-kendo-template" id="appDetails-template">
        content here
    </script>
         
    <script type="text/javascript">
        function renderappDetailsTemplate(data) {
            return kendo.Template.compile($('#appDetails-template').html())(data);
        }
    </script>


    Regards,
    Magdalena
    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
Back to Top