创建Dojo内存会导致未捕获类型错误:无法读取属性';风格';空的

创建Dojo内存会导致未捕获类型错误:无法读取属性';风格';空的,dojo,ibm-mobilefirst,Dojo,Ibm Mobilefirst,我试图创建一个简单的worklight应用程序,但试图创建一个新的内存会导致: 未捕获类型错误:无法在移动ui层读取null的属性“style”。js:378 这看起来很奇怪,因为我不明白创建一个内存对象和样式有什么关系 在Chrome中调试时,我会在var testStore=newmemory({data:storeData})行之后立即得到它 require ( ["dojo", "dojo/parser",

我试图创建一个简单的worklight应用程序,但试图创建一个新的
内存
会导致:
未捕获类型错误:无法在移动ui层读取null的属性“style”。js:378

这看起来很奇怪,因为我不明白创建一个内存对象和样式有什么关系

在Chrome中调试时,我会在
var testStore=newmemory({data:storeData})
行之后立即得到它

require (
                    ["dojo", 
                    "dojo/parser", 
                    "dojo/_base/xhr",
                    "dijit/form/ComboBox",  
                    "dojo/store/JsonRest", 
                    "dojo/ready",
                    "dojox/mobile/EdgeToEdgeStoreList",
                    "dojox/mobile",
                    "dojox/mobile/parser",
                    "dojox/io/xhrWindowNamePlugin",
                    "dojox/io/windowName", 
                    "dojox/io/xhrPlugins", 
                    "dojo/dom-style", 
                    "dojo/dom", 
                    "dojo/dom-class", 
                    "dojo/_base/Deferred",
                    "dojo/store/Memory"], function(JsonRestStore, EdgeToEdgeStoreList, xhrPlugins, Memory) {

            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 testStore = new Memory({data:storeData});
                    var testList = new dojox.mobile.EdgeToEdgeStoreList({store:testStore}, "testList");
                    storeList.startup();
            });

仅供参考:它是worklight 5.0.5

您的主要问题是
require
数组中的所有依赖项都需要与函数中的参数名称匹配。比如说

require(['dep1','dep2','dep3'],function(dep1,dep2,dep3){});
所以我们来推断一下

require(
["dojo",
  "dojo/parser",
  "dojo/_base/xhr",
  "dijit/form/ComboBox",
  "dojo/store/JsonRest",
  "dojo/ready",
  "dojox/mobile/EdgeToEdgeStoreList",
  "dojox/mobile",
  "dojox/mobile/parser",
  "dojox/io/xhrWindowNamePlugin",
  "dojox/io/windowName",
  "dojox/io/xhrPlugins",
  "dojo/dom-style",
  "dojo/dom",
  "dojo/dom-class",
  "dojo/_base/Deferred",
  "dojo/store/Memory"], function (dojo,parser,xhr,ComboBox,JsonRest,ready,EdgeToEdgetStoreList,mobile,parser,xhrPlugin,windowname,xhrPlugins,domStyle,dom,domClass,Deferred,Memory) {

  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"
  }];
    console.log(Memory);
  var testStore = new Memory({

    data: storeData
  });  
    var storeList = new dojox.mobile.EdgeToEdgeStoreList({
    store: testStore
  }, "testList");
  storeList.startup();

});
代码片段中发生的情况是,参数
Memory
实际上是一个与其名称所暗示的不同的类。根据依赖项数组顺序,它是一个
EdgeToEdgeStoreList