override Ext.grid.plugin.RowExpander 방법이 작동하지 않습니다.

2555 단어 overrideext
Ext 버전 4.2
덮어쓰기 방법:
Ext.override(Ext.grid.plugin.RowExpander, {
    setCmp: function (grid) {
        var me = this,
            rowBodyTpl,
            features;
        console.log(' 。。');
        me.callParent(arguments);

        me.recordsExpanded = {};

        me.rowBodyTpl = Ext.XTemplate.getTpl(me, 'rowBodyTpl');
        rowBodyTpl = this.rowBodyTpl;
        features = [{
            ftype: 'rowbody',
            lockableScope: 'normal',
            recordsExpanded: me.recordsExpanded,
            rowBodyHiddenCls: me.rowBodyHiddenCls,
            rowCollapsedCls: me.rowCollapsedCls,
            setupRowData: me.getRowBodyFeatureData,
            setup: me.setup,
            getRowBodyContents: function (record) {
                return rowBodyTpl.applyTemplate(record); //  
            }
        }, {
            ftype: 'rowwrap',
            lockableScope: 'normal'
        }];

        if (grid.features) {
            grid.features = Ext.Array.push(features, grid.features);
        } else {
            grid.features = features;
        }

    }
});

동시에 ext-all-debug를 수정합니다.js에 해당하는 코드는 다음과 같습니다.
 setCmp: function(grid) {
        var me = this,
            rowBodyTpl,
            features;
        console.log('oh my gd!');
        me.callParent(arguments);

        me.recordsExpanded = {};

        me.rowBodyTpl = Ext.XTemplate.getTpl(me, 'rowBodyTpl');
        rowBodyTpl = this.rowBodyTpl;
        features = [{
            ftype: 'rowbody',
            lockableScope: 'normal',
            recordsExpanded: me.recordsExpanded,
            rowBodyHiddenCls: me.rowBodyHiddenCls,
            rowCollapsedCls: me.rowCollapsedCls,
            setupRowData: me.getRowBodyFeatureData,
            setup: me.setup,
            getRowBodyContents: function(record) {
                return rowBodyTpl.applyTemplate(record.getData());
            }
        },{
            ftype: 'rowwrap',
            lockableScope: 'normal'
        }];
 
        if (grid.features) {
            grid.features = Ext.Array.push(features, grid.features);
        } else {
            grid.features = features;
        }
        
    }

사실 방법이 덮어쓰였는지 보기 위해 같은 위치에 출력 문장을 추가했다.코드가 실행되면 다음과 같은 효과가 발생합니다.
 。。                                      RowExpa...ride.js (  6  )
oh my gd!                                         ext-all-debug.js (  117009  )

덮어쓰지 않았다니?!

좋은 웹페이지 즐겨찾기