Dojo gridx:使用;onAfterRow“;禁用";onCellWidgetCreated“是吗?”;?

Dojo gridx:使用;onAfterRow“;禁用";onCellWidgetCreated“是吗?”;?,dojo,dojo.gridx,Dojo,Dojo.gridx,创建gridx时,我使用以下列定义在每行的最后一个单元格中插入编辑按钮: var editColumn = { field : 'Edit', name : '', widgetsInCell: true, onCellWidgetCreated: function(cellWidget, column){ var btn = new Button({ label : "Edit", onCl

创建gridx时,我使用以下列定义在每行的最后一个单元格中插入编辑按钮:

var editColumn = { field : 'Edit', name : '', widgetsInCell: true,
        onCellWidgetCreated: function(cellWidget, column){
            var btn = new Button({
                label : "Edit",
                onClick : function() {
                  console.log('Do stuff here');
            });
            btn.placeAt(cellWidget.domNode);
        }
    };
columns.push(editColumn);
var grid = new Grid({
        cacheClass : Cache,
        store : store,
        structure : columns,
        modules: ["gridx/modules/CellWidget"]
    }, 'gridNode');

 grid.body.onAfterRow = function(row){

        ...do stuff on the row here
    };

当我包含onAfterRow函数时,行处理会发生,但OnCellWidgetCreated不会。每个功能似乎都在缺少其他功能的情况下工作。关于如何操作的任何建议:(1)根据行数据格式化行,以及(2)在每行的最后一个单元格中插入按钮小部件?

好的,解决了它。我的工作方式是:

   aspect.after(grid.body,'onAfterRow',function(row){
        key = row.id;
        if ('anulada' in row.grid.store.get(key)){
            if(row.grid.store.get(key).anulada == true){
                row.node().style.color = 'gray';
            }
        } 
    },true);

您需要使用“dojo/aspect”。

此事件“onAfterRow”只工作一次,第二次不工作