PDA

View Full Version : strange problem with render, afterrender event



no1
3 Aug 2011, 12:43 AM
after bulild my mvc app with 'sencha build' there is a strange problem with my application - viewport render (and afterrender) event doesn't seem to fire, it is defined in my app-all.js file but it doesn't work, do you know why, thanks for any help

in my controller file

init: function() {
this.control({
'viewport': { afterrender: function () { foo.bar() } },
});

},

xenny
25 Mar 2012, 2:42 AM
I guess you can try add the event first while initComponent():

this.addEvents('afterrenderer');

bclinton
25 Mar 2012, 10:00 AM
Although the original post is old, I came across this issue today. Try defining your listeners in the listeners config option of your viewport definition.

like this:



this.viewport = Ext.create('Ext.container.Viewport',
{
layout : { type: 'fit' },
listeners: {
render: function(){ console.log('viewport: render'); },
afterrender: function(){ console.log('viewport: afterrender'); }
},
items: [
{
xtype : 'panel',
title : 'Hi there',
html : 'Hello'
}
]
});