简体   繁体   English

使dojo小部件(如dojox.layout.ContentPane)适用于使用Cordova和NetBeans开发的Android应用

[英]Getting Dojo widgets like dojox.layout.ContentPane working for Android apps developed using Cordova with NetBeans

I'm trying to get widgets like dojox.layout.ContentPane working properly in a Netbeans Cordova environment for Android and iOS. 我正在尝试让dojox.layout.ContentPane之类的小部件在适用于Android和iOS的Netbeans Cordova环境中正常工作。 I'm using as the main contentPane that will render the pages based on what the user press. 我使用的主要contentPane将根据用户按下的内容呈现页面。 Is it possible to get it working or are there better alternatives in Dojo for this purpose? 是否有可能使其工作或在Dojo中为此目的有更好的替代方法?

<script type="text/javascript">    
       require([
            "dojox/layout/ContentPane",
            "dijit/registry",
            "dojo/domReady!"
        ], function(
            ContentPane,
            registry
        ) {
            var contentPanel = new ContentPane({
                ioMethod: dojo.xhrPost,
                executeScripts:"true",
                style: "height: 100%",
                region:"center"
            },"contentPanel");   

            contentPanel.setHref("home.html");

}); });

<div id="contentPanel" padding-bottom:10px">
</div>

This is the error line that appears in firebug console 这是Firebug控制台中显示的错误行

var error = new RequestError('Unable to load ' + response.url + ' status: ' + _xhr.status, response);

Update1: Am suspecting that this is related to Android SDK issue that many others are facing which is caused by _ characters in many of the Dojo files ( Google Issue link ). Update1:​​怀疑这与许多其他Android SDK问题有关,这是由许多Dojo文件中的_字符引起的( Google Issue链接 )。 Dojo Build was suggested. 建议使用Dojo Build。 But I have not manage to "build everything into 1 file" that has been suggested to work 但是我还没有建议“将所有内容构建到1个文件中”

The Dojo Build profile I tried: 我尝试过的Dojo Build配置文件:

var profile = (function(){
return {
    basePath: "./../../../../../web/html/js/",//file path start from Util\dojoSDK\util\buildscripts\profiles
    releaseDir: "./../../../Util/release",
    action: "release",
    layerOptimize: "closure",
    optimize: "shrinksafe",
    cssOptimize: "false",
    mini: false,
    stripConsole: "normal",
    selectorEngine: "acme",

    packages:[/**/{
        name: "dojo",
        location: "../../../Util/dojoSDK/dojo"
    },{
        name: "dojox",
        location: "../../../Util/dojoSDK/dojox"
    },{
        name: "dijit",
        location: "../../../Util/dojoSDK/dijit"
    }],

    layers: {
        "dojo/dojo": {
            include: [
                "dojo/dojo",
                "dojo/i18n",
                "dojo/domReady",
                "dojo/parser"

 *all .js files in Dojo with _*
            ],
            customBase: true,
            boot: true
        }
    }
};
})();

FINAL UPDATE : Apparently this is NOT caused by the underscore issue highlighted in Update1 above. 最终更新 :显然这不是由上面Update1中突出显示的下划线问题引起的。 I have reused the complete example code from Dojo Flickr demo FINAL and integrated dojox.layout.ContentPane to it and EVERYTHING works fine. 我已经重用了Dojo Flickr演示FINAL中的完整示例代码,并将dojox.layout.ContentPane集成到其中,并且一切正常。 Unable to say what exactly helped but I suspect it to be the way the dojo loader is written with things like dojox/mobile/parser and dojox/mobile/compat. 无法说出确切的帮助,但我怀疑这是用dojox / mobile / parser和dojox / mobile / compat之类的东西编写dojo加载程序的方式。

I have since looked into dojo.mobile modules as suggested by frank 此后,我按照Frank的建议研究了dojo.mobile模块

For mobile layout you can use dojox/mobile/view . 对于移动版式,您可以使用dojox / mobile / view

Here is a good tutorial (sample mobile app) on dojo mobile to get you started. 这是关于dojo mobile的很好的教程(示例移动应用程序),可以帮助您入门。 http://dojotoolkit.org/documentation/tutorials/1.10/mobile/flickrview/part2/ http://dojotoolkit.org/documentation/tutorials/1.10/mobile/flickrview/part2/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM