【问题标题】:Dojo grid display Error while using Row Select function with QueryreadStore将行选择功能与 QueryreadStore 一起使用时 Dojo 网格显示错误
【发布时间】:2013-08-23 05:08:14
【问题描述】:

当我使用 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 这个模块,它可以正常工作。任何人都可以提出答案。

【问题讨论】:

    标签: dojox.grid


    【解决方案1】:

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

    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

    【讨论】:

      猜你喜欢
      • 2021-08-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-05
      • 2023-03-16
      • 1970-01-01
      • 1970-01-01
      • 2022-09-27
      相关资源
      最近更新 更多