KENDO UI TEMPLATE FUNCTIONING BASIC QUESTION

2 posts, 0 answers
  1. Saurabh
    Saurabh avatar
    10 posts
    Member since:
    Mar 2012

    Posted 13 Apr 2012 Link to this post

    When is javascript within a template executed? Is it rendered every time the data binding occurs or is it only once? 

    Example - 
    <script id="demoTemplate" type="text/x-kendo-template">
    #if(person) {
       <h1>${person.name}</h1>
    }
    else {
       <h1>${id}</h1>
    }#
    </script>
        <script>
    var data = [{"person":{"name":"saurabh"},"id":123},{"id":123}]

            window.kendoMobileApplication = new kendo.mobile.Application(document.body);
            $(document).ready(function () {
    $("#listUL").kendoMobileListView({
                    template: $("#demoTemplate").text(),
                    dataSource: data
                });
    }
    </script>

    So I want to show ID field when person object is missing in the JSON data. I get following error when I run it - "person variable is missing"

    How do I handle missing variables in templates? How can I check for them?
  2. Saurabh
    Saurabh avatar
    10 posts
    Member since:
    Mar 2012

    Posted 18 Apr 2012 Link to this post

    Could someone at Kendo reply to this? This is critical. How do we handle data if it is null or missing in the binding within a kendo template? 

    Saurabh
  3. Kendo UI is VS 2017 Ready
Back to Top