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

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

1 Answer 28 Views
Templates
This is a migrated thread and some comments may be shown as answers.
AppsWiz
Top achievements
Rank 1
AppsWiz asked on 10 Dec 2015, 12:17 AM

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

1 Answer, 1 is accepted

Sort by
0
Magdalena
Telerik team
answered on 10 Dec 2015, 09:17 AM
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!
 
Tags
Templates
Asked by
AppsWiz
Top achievements
Rank 1
Answers by
Magdalena
Telerik team
Share this question
or