Mary
Mary

Reputation: 67

ExtJS 4.0.2a render and afterrender

I have a TreeGrid. In column renderer, I call some function1.

In tree listeners afterrender, I call some function2.

When I refresh the page, it calls function1 then function2. But when I am sorting columns, function1 gets called but function2 does not.

var tree = Ext.create("Ext.tree.Panel", {
    columns: [{
        text: 'text',
        flex: 1,
        dataIndex: 'id',
        renderer: function(){
            alert("!!!");
        },
    }],
    listeners: {
        afterrender: function(){
        alert("!");
        },
    }
});

Upvotes: 2

Views: 37282

Answers (1)

s_hewitt
s_hewitt

Reputation: 4302

afterrender is an event on the tree.Panel itself, so it will only be called after the tree.Panel is rendered.

Sounds like the column renderer is being called every time the column is rendered; for example, on column sorting.

Upvotes: 4

Related Questions