dojox.data 在尝试创建 dojo 数据网格时未定义

dojox.data is undefined while trying to create a dojo data grid

我第一次使用 XPages 尝试创建 dojo 增强型数据网格。我正在按照我在网上找到的示例进行操作,但出现错误:"dojox.data is undefined"。我几乎没有发现任何关于这个错误的信息,所以显然它对其他人来说一定很简单。我在这里有点迷路,有人可以指出正确的方向来解决这个问题吗?

我的目标是从 ERP 系统查询数据,然后将其显示在网格中。但是,我需要先让它处理硬编码数据。

这是我的 xpage 来源:

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" dojoParseOnLoad="true"
    dojoTheme="true">

    <xp:this.resources>
        <xp:dojoModule name="dojox.grid.EnhancedGrid"></xp:dojoModule>
        <xp:dojoModule name="dojox.grid.enhanced.plugins.DnD"></xp:dojoModule>
        <xp:dojoModule
            name="dojox.grid.enhanced.plugins.NestedSorting">
        </xp:dojoModule>
        <xp:dojoModule
            name="dojox.grid.enhanced.plugins.IndirectSelection">
        </xp:dojoModule>
        <xp:dojoModule name="dojox.grid.enhanced.plugins.Filter"></xp:dojoModule>
        <xp:dojoModule name="dojox.data.ItemFileWriteStore"></xp:dojoModule>

        <xp:styleSheet
            href="/.ibmxspres/dojoroot/dijit/themes/dijit.css">
        </xp:styleSheet>
        <xp:styleSheet
            href="/.ibmxspres/dojoroot/dojox/grid/resources/Grid.css">
        </xp:styleSheet>
        <xp:styleSheet
            href="/.ibmxspres/dojoroot/dojox/grid/resources/tundraGrid.css">
        </xp:styleSheet>
        <xp:styleSheet
            href="/.ibmxspres/dojoroot/dojox/grid/enhanced/esources/EnhancedGrid.css">
        </xp:styleSheet>
        <xp:styleSheet
            href="/.ibmxspres/dojoroot/dojox/grid/enhanced/esources/tundraEnhancedGrid.css">
        </xp:styleSheet>
    </xp:this.resources>

    <xp:br></xp:br>


    <xp:div id="gridDiv"></xp:div>

<xp:eventHandler event="onClientLoad" submit="false">
    <xp:this.script>
        <xp:executeClientScript>
            <xp:this.script><![CDATA[dojo.addOnLoad(function(){

   //setup the grid layout, format = {'name': 'columntitle', 'field': 'fieldname'}
    var layout = [{
    defaultCell: {editable: false, type: dojox.grid.cells._Widget},
    rows:[
       {'field': "qtno", 'name': "Quote No.", 'width': '20px'},
       {'field': "cusno", 'name': "Cust #", 'width': '20px'},
       {'field': "cusnm", 'name': "Customer", 'width': '30px'},
       {'field': "qtamt", 'name': "Quote Amt", 'width': '20px'},  
       ]    
    }]

    //setup data store
    var data = {
      identifier: 'id',
      items: []
    };

    //setup data array of strings, format = {fieldname: "strvalue", fieldname: numvalue} 
    var data_list = [
      { qtno: "Q01234", cusno: "4419", cusnm: "ABC Corporation", qtamt: 29.91},
      { qtno: "Q42198", cusno: "3308", cusnm: "Acme Company", qtamt: 9.33},
      { qtno: "Q11095", cusno: "7041", cusnm: "XYZ Industries", qtamt: 19.34}
    ];

    //default the rows
    var rows = 100;

    //populate the store with the data array of strings
    for(var i=0, l=data_list.length; i<rows; i++){
      data.items.push(dojo.mixin({ id: i+1 }, data_list[i%l]));
    }
    var store = new dojox.data.ItemFileWriteStore({data: data});

    //define the grid
    var grid = new dojox.grid.EnhancedGrid({
        id: 'grid',
        query: {}, 
        store: store,
        structure: layout,
        rowSelector: '20px',
        autoHeight: 25
    }, '#{id:gridDiv}');

    //create it
    grid.startup();

})


]]></xp:this.script>
        </xp:executeClientScript>
    </xp:this.script></xp:eventHandler></xp:view>

而且,这是错误:

TypeError: dojox.data is undefined
Stack trace:
view__id1__id3_clientSide_onClientLoad/<@http://domsvr3.mphassoc.com/dev/MiscDev.nsf/DataGrid.xsp:87:9

dojox.data 资源应该是 dojo.data。

使用 dojo.data,因为它不再是实验性 Dojo 包 dojox 的一部分。