【问题标题】:Dojo gridx: using "onAfterRow" disables "onCellWidgetCreated"?Dojo gridx:使用“onAfterRow”禁用“onCellWidgetCreated”?
【发布时间】:2014-11-29 19:04:49
【问题描述】:

在创建 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)在每行的最后一个单元格中插入按钮小部件的任何建议?

【问题讨论】:

    标签: dojo dojo.gridx


    【解决方案1】:

    好的,解决了。而不是分配 grid.body.onAfterRow,对我有用的方式是:

       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'只有效一次,第二次无效
    猜你喜欢
    • 2015-11-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多