0

renderRowグリッドのイベント後に実行される関数を結び付けようとしています。だから私はDOJOのaspect.afterを使いましたが、キッカーはここにあります。これは、行が実際にレンダリングされる前に実行されるため、divs\tds はまだ画面に表示されていません。そして、アイテムの位置を使用したいので、 を使用するdojo/domgeometryと、ゼロで満たされたオブジェクトが返されます。行の表示が終了した後に関数が実行されることを保証するにはどうすればよいですか?

以下に、私が呼び出している JS を示します。

    aspect.after(grid, 'renderRow', function(row, args) {
        var object = args[0];
        if (object.type == 'tipo_exec') {
            row.className += ' black';
        } else if(object.type == 'exec') {
            row.className += ' gray';
        } else if(object.type == 'ic') {
            if ((typeof(object.dep)!='undefined') && (object.dep.length > 0)) {
                require(['dojo/dom-geometry','dojo/dom-construct'],
                    function(domGeom, domConstruct){
                        console.log(domGeom.position(row));
                    }
                );
            }
        }
        return row;
    });

編集:別のこと、私はツリー拡張機能を使用しています.renderRowは、親をクリックして展開した後に発生します。

編集:必要な場合に備えて、ここにもう少し情報があります。ストアはシンプルです。

    store = new Observable(new Memory({'data': data,
        'getChildren': function(parent, options){
            return this.query({'parent': parent.id}, options);
        },
        'mayHaveChildren': function(parent){
            return parent.hasChildren;
        }
    }));

グリッドは次のように宣言されます。

grid = new (declare([OnDemandGrid, Selection, Keyboard, CompoundColumns]))({
        'columns': nCols,
        'query': { 'parent': undefined },
        'store': store

    }, gridId);

これがアフターアスペクトの内部です

if ((typeof(object.dep)!='undefined') && (object.dep.length > 0)) {
    console.log('just before adding the refresh');
        on.once(this, 'dgrid-refresh-complete', function(){
            console.log('finished refreshing');
            require(['dojo/dom-geometry','dojo/dom-construct'],
                function(domGeom, domConstruct){
                    console.log(domGeom.position(node));
                }
            );
        });
}

console.log('finished refreshing');呼び出されず、位置ログも呼び出されません。

グリッドには多くの列があり、いくつかは合成列に結ばれ、ツリーである名前の列、および他のいくつかの列があります。ツリーを展開するときに renderRow が呼び出されます。

いくつかのデータが削除されたグリッドの画像

4

1 に答える 1