kendo.toString formatted date not rendering

9 posts, 0 answers
  1. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 07 Jul 2014 Link to this post

    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?
  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 08 Jul 2014 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 08 Jul 2014 in reply to Alexander Valchev Link to this post

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

    http://screencast.com/t/umJauWlk

  5. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 10 Jul 2014 Link to this post

    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!
     
  6. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 10 Jul 2014 in reply to Alexander Valchev Link to this post

  7. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 11 Jul 2014 Link to this post

    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!
     
  8. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 11 Jul 2014 in reply to Kiril Nikolov Link to this post

    GAH!  I didn't even SEE that there...the Linter doesn't pick that up does it?
  9. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 11 Jul 2014 Link to this post

    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!
     
  10. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 11 Jul 2014 in reply to Kiril Nikolov Link to this post

    Was talking about the Kendo Chrome Extension Linter...so no chance eh
Back to Top
Kendo UI is VS 2017 Ready