0

当我使用 gridx/modules/select/Row 模块时,dojo 网格出现问题,网格不显示。它给出类型错误:节点为空。我的布局结构在这里:

<script type="text/javascript">   
    var itemGridStore = new dojox.data.QueryReadStore({url:'invoiceConsignSearchStore'});
     console.debug('store ::'+itemGridStore);
     var layout=[ 
                      {id:"consId", field:"Consignment_Id", name:"Consignment Id", width:"23%"},
                      {id:"poDate", field:"Date", name:"Date", width:"30%"},
                      {id:"poNo", field:"PoSo_No", name:"Purchase Order No", width:"25%"},
                      {id:"refId", field:"Reference_Id", name:"Reference Id", width:"25%"},
                      {id:"customerName", field:"customerName", name:"Name/Company", width:"25%"},
                      {id:"location", field:"location", name:"Location", width:"25%"},
                      {id:"dealId", field:"Deal_Id", name:"Deal Id", width:"25%"}
                         ];
             var itemListgrid = new gridx.Grid({
                 cacheClass: gridx.core.model.cache.Async,
                 store: itemGridStore,
                 structure: layout,                
                 modules: [                        
                           "gridx/modules/VirtualVScroller", "gridx/modules/SingleSort", "gridx/modules/CellWidget", "gridx/modules/Edit",
                           "gridx/modules/Filter",  "gridx/modules/filter/FilterBar","gridx/modules/RowHeader","gridx/modules/select/Row", "gridx/modules/select/Cell"
                       ],
                 vScrollerBuffSize: 30  ,
                 selectRowTriggerOnCell: true,
                 editLazySave: true
             }, 'gridNode'); //Assume we have a node with id 'gridNode'
             itemListgrid.startup();

            itemListgrid.connect(itemListgrid,"onRowClick",function(evt){
                var rowsSel=itemListgrid.select.row.getSelected();
                console.debug('rowsSel ::'+rowsSel);
                doImportSelectedItem(rowsSel);
             });
    </script>

<body class="tundra">
    <!-- We'd like to show a grid here -->
    <div align="center" id="gridNode"></div>
    </body>
</html>

但如果没有 gridx/modules/select/Row 这个模块,它可以正常工作。任何人都可以提出答案。

4

1 回答 1

0

选择模块需要标记模型扩展,因此您的网格应如下所示:

var itemListgrid = new gridx.Grid({
    cacheClass: gridx.core.model.cache.Async,
    store: itemGridStore,
    structure: layout,
    modelExtensions: [
        "gridx/core/model/extensions/Mark"
    ],
    modules: [                        
        "gridx/modules/VirtualVScroller", 
        "gridx/modules/SingleSort",
        "gridx/modules/CellWidget",
        "gridx/modules/Edit",
        "gridx/modules/Filter",
        "gridx/modules/filter/FilterBar",
        "gridx/modules/RowHeader",
        "gridx/modules/select/Row",
        "gridx/modules/select/Cell"
    ],
    vScrollerBuffSize: 30,
    selectRowTriggerOnCell: true,
    editLazySave: true
}, 'gridNode');

有关模块兼容性,请查看此链接: http: //oria.github.io/gridx/moduleCompatibility.html

于 2014-01-21T16:27:27.213 回答