我在哪里调用函数来编程创建Dojo组件?
function wlCommonInit(){
var busy = new WL.BusyIndicator("content", { text: "Caricamento ..."});
busy.show(); // Show busy indicator
require([ "dojo/core-web-layer", "dojo/mobile-ui-layer",
"dojo/mobile-compat-layer" ], dojoInit);
busy.hide();
}
var codici_clienti_data,ragione_sociale_data,listini_cliente_data,listini_cliente_completi,ordini_cliente_data,ordine_cliente_dettaglio,ordine_cliente_dettaglio_articolo;
function creaOggettiDojo(){
//creo edgeToEdge List per lista ordini clienti
require([
"dojo/ready",
"dojo/store/Memory",
"dojox/mobile/EdgeToEdgeStoreList",
"dojox/mobile",
"dojox/mobile/parser"
], function(ready, Memory, EdgeToEdgeStoreList){
dojo.ready(function(){
var storeData = [
{ "label": "Wi-Fi", "icon": "images/i-icon-3.png", "rightText": "Off", "moveTo": "bar" },
{ "label": "VPN", "icon": "images/i-icon-4.png", "rightText": "VPN", "moveTo": "bar" }
];
var sampleStore = new Memory({data:storeData, idProperty:"label"});
var storeOrdiniClienti = new EdgeToEdgeStoreList({store:sampleStore}, "storeOrdiniClienti");
storeOrdiniClienti.startup();
});
});
//fine lista ordini clienti
}
function dojoInit() {
require([ "dojo", "dojo/parser", "dojox/mobile", "dojox/mobile/compat", "dojox/mobile/deviceTheme",
"dojox/mobile/ScrollableView",
"dojox/mobile/ScreenSizeAware",
"dojox/mobile/FixedSplitter",
"dojox/mobile/Container",
"dojox/mobile/Heading",
"dojox/mobile/EdgeToEdgeList",
"dojox/mobile/ListItem",
"dojox/mobile/RoundRect",
"dojox/mobile/TabBar",
"dojox/mobile/TabBarButton",
"dojox/mobile/Button",
"dijit/form/DataList",
"dojox/mobile/ComboBox",
"dojox/mobile/EdgeToEdgeStoreList",
"dojo/store/Memory",
"dojox/mobile/EdgeToEdgeDataList",
"dojo/data/ItemFileReadStore", "dojo/data/ItemFileWriteStore"
],
function(dojo) {
dojo.ready(function() {
});
});
}
我试图在代码的各个部分调用函数creaOggettiDojo(),但是没有组件的渲染。有什么问题?
答案 0 :(得分:3)
应该在dojo.ready中调用它。
function dojoInit() {
require([ "dojo", "dojo/parser", "dojox/mobile", "dojox/mobile/compat", "dojox/mobile/deviceTheme", "dojox/mobile/ScrollableView" ],
function(dojo) {
dojo.ready(function() {
creaOggettiDojo();
});
});
}
删除creaOggettiDojo文件中的第二个dojo.ready。
在您的项目中还有一个名为build-dojo.xml的文件。在该文件中添加
<include name="dojox/mobile/parser.js" />
到patternset标签。
还要确保您的html文件包含列表容器。
前<ul id="storeOrdiniClienti"></ul>