Viewmodel not displaying in mobile

3 posts, 0 answers
  1. Anupam
    Anupam avatar
    3 posts
    Member since:
    Nov 2014

    Posted 08 Dec 2014 Link to this post

    Hello. I have created a Kendo UI core widget project. I have created a viewmodel source code as home.js and am try to bind it with div of indexx.html.. 

    This is the home.js.

    var vm = kendo.observable({
        isLoggedIn: true,
        isLoggedIn1: true,
       <other variables, functions});
    kendo.bind(document.body($("#view2")), vm, kendo.mobile.ui);

    After the binding when i run the code in iphone or android simulator it works perfectly, but when I check it in device, the div tag and its elements are not rendered. If If i remove script tag reference of home.js the page is rendered perfectly fine but then there is no functionality.

    Please advice.
  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2894 posts

    Posted 09 Dec 2014 Link to this post

    Hi Anupam,

    If I understood correctly you are building a Kendo Mobile Application. If that is the case please do not cal manually kendo.bind but use the approach described in this help article.

    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. Anupam
    Anupam avatar
    3 posts
    Member since:
    Nov 2014

    Posted 09 Dec 2014 in reply to Alexander Valchev Link to this post

    Thanks for replying. I tried as you suggested, rather copied the whole example as below

    <div data-role="view" data-title="test" data-layout="main" data-model="foo">
        <span data-bind="text:bar"></span>
    </div>

    <script>
     var foo = { bar: "baz" }
    </script>

    Now the screen is coming blank even in simulator.  app.js has following initializations as well.

    app = new kendo.mobile.Application(document.body, {

                // comment out the following line to get a UI which matches the look
                // and feel of the operating system
                skin: 'flat',

                // the application needs to know which view to load first
                initial: 'views/home.html'
            });

        }, false);

    Please advise.












Back to Top