Skip to content Skip to sidebar Skip to footer

Ext Js Event Fired Or Called After Renderer

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

Solution 1:

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 executionrenderer: function(value) {

            // wrapping in a deferred function so that it fires AFTERExt.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.

Post a Comment for "Ext Js Event Fired Or Called After Renderer"