Recursive kendo template

2 posts, 0 answers
  1. devster
    devster avatar
    19 posts
    Member since:
    Oct 2009

    Posted 14 May 2014 Link to this post


    I have a grid that has a clientdetailtemplate. In that template, i use another grid, that would call the same template again untill maybe 3 levels down.
    Is that possible? I get invalid client template, but thats maybe it is just not possible by design. When i add .toclienttemplate on the grid, it does not give an error, but nothing seems to happen.

    <div id="dvResults" class="searchResults col-md-6 col-md-offset-3">
        <div id="resultGrid">
                  .HtmlAttributes(new { @class = "grdSearchResults" })
                  .Columns(column =>
                      column.Bound(x => x.Icon).Template(@<text><img src="@item.Icon" class="searchicon" /></text>).Width(16);
                      column.Bound(x => x.Name).Template(
                          @<text><a onclick="SelectEntity('@item.CustomerId','@item.PremisesId','@item.InvoiceStructureId')">@item.Name</a>
                               @if (@item.IsCustomerLevel)
                                   <br /><text>@item.SearchCriteria : @item.Field</text>
    <script id="gridDetailTemplate" type="text/kendo-tmpl">
            .HtmlAttributes(new { @class = "grdSearchResults" })
            .Columns(column =>
                column.Bound(x => x.Icon);

  2. Daniel
    Daniel avatar
    2110 posts

    Posted 16 May 2014 Link to this post


    The ToClientTemplate method should always be used for controls that are included in a template. Otherwise, the "#" character used at least for the id selector will not be escaped by the control and the template will be invalid. 
    As for the case when the method is not called - what is the value of the "Children" property. The detail grid will not be initialized if the value of the property is not valid for an element ID.

    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top