使用带有QueryreadStore的行选择功能时,Dojo网格显示错误

时间:2013-08-23 05:08:15

标签: dojox.grid

当我使用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这个模块就可以了。任何人都可以提出答案。

1 个答案:

答案 0 :(得分: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