dojox / app - 使用标准小部件

时间:2013-11-13 08:36:47

标签: javascript dojo dojox.app

我想用dojox / app编写简单的应用程序,但不想用于移动设备(每个例子都用于移动应用程序)。 首先,我通过设置此配置文件修改实际应用程序:

{
"id": "simpleModelApp",
"name": "Simple Model App",
"description": "A simple app to show how to use different types of Stores and Models",
"splash": "splash",

"dependencies": [
    "dojo/parser",
    "dijit/layout/ContentPane",
    "dojo/store/Memory",
    "dojo/data/ItemFileWriteStore",
    "dojo/store/JsonRest",
    "dojox/app/utils/mvcModel",
    "dojox/mvc/EditStoreRefListController",
    "dojo/store/DataStore"
],
"modules": [],

"controllers": [
    "dojox/app/controllers/Load",
    "dojox/app/controllers/Transition",
    "dojox/app/controllers/Layout"
],  

//stores we are using 
"stores": {
},

"models": {
},

"has" : {
    "ie9orLess" : {
        "controllers": [
            "dojox/app/controllers/HistoryHash"
        ]
    },
    "!ie9orLess" : {
        "controllers": [
            "dojox/app/controllers/History"
        ]
    }
},  

"defaultView": "home",

"defaultTransition": "slide",

"views": {

    "home": {
        "dependencies":["dojo/parser", "dijit/layout/ContentPane", "dijit/layout/BorderContainer"],
        "template": "./main/main.html"
    }
}
}

然后我为视图模板编写简单的html:

<div data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'sidebar', gutters:true, liveSplitters:true" id="borderContainer">
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="splitter:true, region:'leading'" style="width: 100px;">Hi, I'm leading pane</div>
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="splitter:true, region:'center'">Hi, I'm center pane</div>

使用已定义的配置文件运行应用程序:

var cfg = jsonRef.fromJson(config);
Application(cfg);

应用程序应该通过拆分器(BorderContainier)拆分widnow(浏览器) 但是不能正常工作。是否可以使用普通wigets创建桌面应用程序?还是只有手机? (我正在使用dojo 1.9.1)

1 个答案:

答案 0 :(得分:0)

查看https://github.com/dmachi/dojox_application/tree/master/tests/borderLayoutApp

这显示了如何正确导入djit主题,基本上有边框布局。

作为任何视图的注释,你必须在任何其他dijit类型之前有一个包装div。 这是因为视图是在顶部div上创建的。