template not displaying data on mobile

3 posts, 0 answers
  1. Jose
    Jose avatar
    2 posts
    Member since:
    Mar 2014

    Posted 20 Mar 2014 Link to this post

    Hi,

    So, im using a template binded to remote data. Everything works well on the emulator but on the device only the button appears.
    code:

        <form>
                <ul id="books" data-template="template" data-role="listview" data-style="inset" data-bind="source:fields"></ul>
                <button data-role="button" id="save" type="button" class="login-button">Save</button>
      </form>
       <script id="template" type="text/x-kendo-template">
               <li >
                        <label for="page">#: Caption #</label>
                        # if (EditConfigType =="Lookup"){
                        #<select id="dropdown"></select>#
                        }
                        if (EditConfigType =="Integer"){
                        #<input type="number"  />#
                        }#
              </li>
      </script>
    <script>
                $(function () {
                    // create a template using the above definition    #: Caption #
                    var template = kendo.template($("#template").html());

                    var dataSource = new kendo.data.DataSource({
                        transport: {
                            // specify the XML file to read. The same as read: { url: "books.xml" }
                            read: {
                                url: "http://41.74.247.118/3GS_API/appapi.svc/uitemplatefields/2120b826-8db8-435c-97db-a1a753fc3e1a",
                                dataType: "json"
                            },
                            
                        },
                        schema: {
                            model: {
                                fields: {
                                    IdEditConfig: { type: "string" },
                                    Caption: { type: "string" },
                                    EditConfigType: { type: "string" },
                                    Required: { type: "number" },
                                }
                            }
                        },
                        change:
                            function (e) {
                            $("#books").html(kendo.render(template, this.view()));
                        }
                    });

                    dataSource.read();
                    dataSource.fetch(function () {
                        var data = this.data();
                        console.log(data[0].IdEditConfig + " | " + data[0].Caption + " | " + data[0].EditConfigType + " | " + data[0].Required + " | ");
                    });
                });
            </script>

    please help! Thanks!
  2. Jose
    Jose avatar
    2 posts
    Member since:
    Mar 2014

    Posted 20 Mar 2014 in reply to Jose Link to this post

    Found the bug, there was a DatePicker instruction breaking the code for mobile. Is DatePicker not usable with android mobile?
  3. Kendo UI is VS 2017 Ready
  4. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 24 Mar 2014 Link to this post

    Hi Jose,

    The DatePicker works fine on android - however, the widget itself is not part of the Kendo UI Mobile bundle - you need to use the Kendo UI Complete file kendo.all.min.js.

    Regards,
    Petyo
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top