我尝试了类似的事件render
,但不知何故,afterrender
它们都在创建 DOM 元素之前拍摄。renderer()
defaultRenderer()
Ext.define( 'MyApp.column.MyColumn', {
extend: 'Ext.grid.column.Column',
constructor: function() {
this.callParent( arguments );
this.on( 'afterrender', function() {
var oDomElement = Ext.get( 'MyColumn.MyApp.model.Record-0-ext-record-22' );
console.log( 'DOM-Element: ', oDomElement );
} );
},
defaultRenderer: function( d, m, oRecord ) {
return '<div id="MyColumn.' + oRecord.id + '" />';
}
} );
当我之后检查 DOM 时,具有 ID 的元素MyColumn.MyApp.model.Record-0-ext-record-22
存在,但在触发oDomElement
时始终为空。afterrender