Reputation: 4021
I have a grid column which uses the renderer function. Are the any events fired or called after this? I have tried several ones but they all get called on the whole column and they all fire before the renderer (even event afterrender)
thanks in advance
Upvotes: 0
Views: 4599
Reputation: 11486
afterrender
only fires once when the column is laid out on the page. It is a basic ExtJS component event that almost all ExtJS components have and doesn't relate to the renderer function used for grid columns.
Not totally sure what you're trying to do this for... but if I wanted to trigger an event whenever my renderer function was executed I would fire a custom event from the renderer function itself. Something like this:
Ext.create('Ext.grid.Panel', {
title: 'After Renderer Event Demo',
store: Ext.getStore('DummyData'),
columns: [{
text: 'Column 1',
dataIndex:'aNumber',
// dummy renderer function that fires an event after execution
renderer: function(value) {
// wrapping in a deferred function so that it fires AFTER
Ext.defer(function() {
this.fireEventArgs('aftercolumnrenderer', arguments);
}, 10);
if (value === 1) {
return '1 person';
}
return value + ' people';
}
}, {
text: 'Column 2',
dataIndex:'aString'
}],
width: 400,
forceFit: true,
renderTo: Ext.getBody()
});
I could listen for it directly with:
myColumn.on('aftercolumnrenderer', function(value, metaData, record, rowIndex, colIndex, store, view) {
// do stuff
});
Or from within a controller's control function if you're using ExtJS MVC.
Also see fireEventArgs and the on method for reference.
Upvotes: 1