Вопрос

I am using the new released kendoui 2013, phonegap 2.6.0, ios emulator 6.1 and iphone 4s(ios 6.1).

I have try two ways: 1) use the phonegap generated index.html and add kendoui css and javascript by hand. 2) write a simple kendoui index.html without phonegap's javascript.

both way will hang on the start screen(not display index.html yet). But if I remove the follow code, it won't hang and will display the index.html.

var app = new kendo.mobile.Application();

Then I add an alert to under the code:

var app = new kendo.mobile.Application();
alert("ddddd");

the alert will display on the start screen, but it then still hangs on the start screen and will not display the index.html.

It seems that there are some async task in the kendoui initial function, and can not be finished on device.

source code of index.html:

<!DOCTYPE html>
<!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
-->
<html>
    <head>
        <meta charset="utf-8" />
        <meta name="format-detection" content="telephone=no" />
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
        <!-- <link rel="stylesheet" type="text/css" href="css/index.css" /> -->
        <link href="1/css/kendo.mobile.all.min.css" rel="stylesheet" />
        <title>Hello World</title>
    </head>
    <body>
        <div data-role="view" id="home">
            <header data-role="header">
                <div data-role="navbar">
                    dddd
                </div>
            </header>
        </div>
        <script type="text/javascript" src="cordova-2.6.0.js"></script>
        <script src="1/js/jquery.min.js"></script>
        <script src="1/js/kendo.all.min.js"></script>
        <script type="text/javascript" src="js/index.js"></script>
        <script type="text/javascript">
            app.initialize();
            var app = new kendo.mobile.Application();
        </script>
    </body>
</html>

Any suggestion to solve this?

Это было полезно?

Решение

Along with removing app.initialize(), you need to move the var app = new kendo.mobile.Application(); initialization call to the PhoneGap's deviceready event.

<script>

    document.addEventListener("deviceready", onDeviceReady, false);

    function onDeviceReady() {

        // Now safe to use the Cordova API
        var app = new kendo.mobile.Application();
    }

</script>

Другие советы

You're trying to use a method of app, before it is assigned. Additionally, there's no such method in Kendo UI Mobile's Application. Just remove the app.initialize() row and your app would probably work.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top