Using same template on template

2 posts, 1 answers
  1. Jaime
    Jaime avatar
    4 posts
    Member since:
    Sep 2015

    Posted 14 Jul 2017 Link to this post

    Hi!, i'm trying to use a template into the same template. This is the code:

    <script id="nestedTemplate" type="text/x-kendo-template">
        <li><b>#: _folderName #</b>
        <ul data-template="nestedTemplate" data-bind="source: _folders"></ul>
        <ul data-template="filesTemplate" data-bind="source: _files"></ul>

    json (remote)

            "_folderName": "Dpto CGE",
            "_folders": [
                "_folderName": "Informes Test",
                "_folders": [
                "_files": [
                    "OriginalPath": "Comparativa de Planificación Mensual con Producción Hasta Marzo 2013.sql"
                    "OriginalPath": "Comparativa de Planificación Mensual con Producción.sql"
                    "FullPath": "\\\\\\pfolder$\\jgperez\\Control De Gestión\\Informes Gema\\Obras.xls"

    So, the template is calling itself each _folders is found but it doesn't works: : e.bind is not a function

    Can i use nested templates with MVVM?



  2. Answer
    Dimitar avatar
    814 posts

    Posted 18 Jul 2017 Link to this post

    Hello Jaime,

    On the following Dojo example you will find a simple source binding to array, where a nested template is used for the list items. 

    In such cases, a single root element should be used in the template, because otherwise the binding will not work as expected. In the provided code sample the nested template looks correct. You can check your upper-level templates for the same requirement. You can find more information in the following source bindings article.

    Please review the provided implementation and and try to incorporate it in your project. In case the issue continues to persist, you can modify the provided Dojo example or create a new one and send it back to us for a review, so that we can examine it locally and provide you with further assistance.

    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top