kendo.toString formatted date not rendering

1 Answer 2592 Views
Templates
sitefinitysteve
Top achievements
Rank 2
Veteran
sitefinitysteve asked on 07 Jul 2014, 06:58 PM
This is my template

<script id="itemTemplate" type="text/html">
    # if(data.IsSandbox){ #
        <div class="draft">
    # } else {#
         <div class="live">
    # } #
       # if(data.IsSandbox){ #
            <strong class="text-info">#: Name # (#: ProgramDesignID #)</strong>
        # } else {#
            <strong class="text-success">#: Name # (#: ProgramDesignID #)</strong>
        # } #
 
        <div class='detailcontainer'>
            <div class='date'>
                # kendo.toString(kendo.parseDate(data.DateDetails.StartDate), "dd/MM/yyyy"); #
            </div>
            <div class='details'>
                #: Details.ProgramName #
            </div>
        </div>
    </div>
</script>


So nothing shows up in the .date DIV...

If I change that line to be
# console.log(kendo.toString(kendo.parseDate(data.DateDetails.StartDate), "dd/MM/yyyy")); #

The JS console in my browser shows all the dates properly formatted for me...why are they not rendering as strings in the template?

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 08 Jul 2014, 04:13 PM
Hi Steve,

# <something> # executes code. #= <something # or #: <something> # renders the returned value. This is part of the Kendo template fundamentals which you can read here.
<div class='date'>
  #= kendo.toString(kendo.parseDate(data.DateDetails.StartDate), "dd/MM/yyyy"); #
</div>



Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
sitefinitysteve
Top achievements
Rank 2
Veteran
commented on 08 Jul 2014, 04:35 PM

Already tried that...if there's a #= or #: code just seems to silently fail

http://screencast.com/t/umJauWlk

Alexander Valchev
Telerik team
commented on 10 Jul 2014, 11:41 AM

Hi Steve,

I tried to reproduce the issue in a sample page but to no avail. Could you please check it and let me know what I am missing?

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
sitefinitysteve
Top achievements
Rank 2
Veteran
commented on 10 Jul 2014, 02:06 PM

Kiril Nikolov
Telerik team
commented on 11 Jul 2014, 12:03 PM

Hello Steve,

Removing the semicolon fixes the problem, please check it here:

http://jsbin.com/voyoboqu/5/edit 

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
sitefinitysteve
Top achievements
Rank 2
Veteran
commented on 11 Jul 2014, 02:25 PM

GAH!  I didn't even SEE that there...the Linter doesn't pick that up does it?
Kiril Nikolov
Telerik team
commented on 11 Jul 2014, 03:34 PM

Hello Steve,

I am not sure which linter are you using, but you can test it and see if it works or not. In general linters do not work well inside Kendo UI Templates.

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
sitefinitysteve
Top achievements
Rank 2
Veteran
commented on 11 Jul 2014, 03:35 PM

Was talking about the Kendo Chrome Extension Linter...so no chance eh
Tags
Templates
Asked by
sitefinitysteve
Top achievements
Rank 2
Veteran
Answers by
Alexander Valchev
Telerik team
Share this question
or