在Dojo Gridx中使用onCellWidget创建(将按钮添加到单元格)

问题描述:

我尝试将一个按钮添加到Gridx的最后一列,但是,该按钮未显示,而其他表格数据上方的网格仅显示“加载”。 ..“。在Dojo Gridx中使用onCellWidget创建(将按钮添加到单元格)

enter image description here

细胞的widget是必需的,声明,widgetInCell被设置和onCellWidgetCreated功能加入。使用alert替换onCellWidgetCreated函数时,会显示每行的警报消息,并且“加载...”消失。我的感觉是onCellWidgetCreated函数是错误的?

我的代码如下所示,并将它与Gridx网站上的一些示例进行比较时,我找不到问题。

require([ 
    "gridx/Grid", 
    "gridx/core/model/cache/Sync", 
    "dojo/store/Memory", 
    "dojo/domReady!", 
    "gridx/modules/CellWidget", 
    "dijit/form/Button" 
], function(Grid, Cache, Memory,Button,CellWidget,domConstruct){ 
     var store = new Memory({ 
      idProperty:"CategoryID", 
      data: jsondata 
     }); 

     var grid = new Grid({ 
      id:"gridId", 
      store: store, 
      cacheClass: Cache, 
      structure: [ 
       { 
        id: "0", 
        field: "CategoryID", 
        name: "Kategorie (ID)", 
        width: "100px" 
       }, 
       { 
        id: "1", 
        field: "CategoryName", 
        name: "Kategoriename" 
       }, 
       { 
        id: "2", 
        field: "Attributes", 
        name: "Attribute" 
       }, 
       { 
        id: "3", 
        field: "Actions", 
        name: "Aktion", 
        widgetsInCell: true, 
        onCellWidgetCreated: function(cellWidget, column){ 
         var btn = new Button({ 
          label: "Click me!" 
         }); 
         btn.placeAt(cellWidget.domNode); 
        } 
       } 
      ], 
      modules: [ 
       CellWidget 
      ] 
     }); 
     grid.placeAt("aGrid"); 
     grid.startup(); 


    } 
); 

我遇到了VirtualVScrolling的另一个问题,并发现这是由于包含自定义布局的缺陷gridx css文件造成的。 当使用标准的css文件时,“onCellWidgetCreated”也适用于我。