Template processing

2 posts, 0 answers
  1. Robert
    Robert avatar
    16 posts
    Member since:
    Jan 2014

    Posted 01 Mar 2014 Link to this post

    I am trying to create a collapsible div inside a template. It won't work. 

    Basically the logic is like this....
    <script type="text/x-kendo-template" id="workshopslist-listview-template">
               #   var _d  = description; var _d_short = _d.substring(0,20); #
                #   if (_d.length>40) { #
                    <div id="${id}_ch" style="color:#00CCFF;display:block;" data-click="toggle" data-parmid="${id}">
                    <h4> #: _d_short #...</h4>
                    <div id="${id}_cc" style="display:none;" data-click="toggle" data-parmid="${id}">
                    <p>#: _d #</p>
                    # } else { #
                        <p>#: _d #</p>
                        # } #

    My attempts are frustrated in that I can't find any serious documentation on template processing, using conditional inside a template.

    I;ve tried to use                 <div id="#: id #_ch" style="color:#00CCFF;display:block;" data-click="toggle" data-parmid="#: id #"> but it doesn't work.


  2. Atanas Korchev
    Atanas Korchev avatar
    8462 posts

    Posted 03 Mar 2014 Link to this post

    Hi Robert,

    The Kendo UI template documentation is available here.

    I've checked your template definition and the only problem I saw was one unescaped # in the color setting. Escaping it should make it work:
    <div id="${id}_ch" style="color:\#00CCFF;display:block;" data-click="toggle" data-parmid="${id}">

    Atanas Korchev
    Icenium is now Telerik AppBuilder, and is part of the Telerik Platform. For more information on the new name, and to learn more about the Platform, register for the free online keynote and webinar on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT)
Back to Top