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

Template processing

1 Answer 35 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Robert
Top achievements
Rank 1
Robert asked on 01 Mar 2014, 02:13 PM
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">
     <h3>${name}</h3>
           #   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>
                <div id="${id}_cc" style="display:none;" data-click="toggle" data-parmid="${id}">
                <p>#: _d #</p>
                
                </div>
                # } else { #
                    <p>#: _d #</p>
                    # } #
      <p>${other}</p>
</script>

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.

Lost
Robert


1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 03 Mar 2014, 03:56 PM
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}">


Regards,
Atanas Korchev
Telerik
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)
Tags
General Discussion
Asked by
Robert
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or