PDA

View Full Version : [INFOREQ] viewport event not firing : version: 360



BostonMerlin
6 Apr 2012, 8:35 AM
I added the viewport config to my project and added an event (initialize onViewportInitialize) but it never fires. The launch event under Application fires no problem, though. All of this was done via the Designer UI

Thanks,
John

aconran
6 Apr 2012, 9:42 AM
Please paste the relevant code generated for app.js here

BostonMerlin
6 Apr 2012, 9:49 AM
Here ya go...



Ext.Loader.setConfig({
enabled: true
});


Ext.application({
viewport: {
style: 'background-color:lightBlue;',
layout: {
animation: false,
type: 'card'
}
},


views: [
'C360Container',
'MainContainer',
'WidgetBase',
'WidgetContainer',
'WidgetHousehold',
'LoginContainer'
],
name: 'MyApp',
controllers: [
'LoginController',
'MainController'
],


onViewportInitialize: function(component, options) {
console.log('viewport init');
},


launch: function() {
console.log('app launch');


var login = Ext.create('MyApp.view.LoginContainer');
Ext.Viewport.add(login);
Ext.Viewport.on([
{
event: 'initialize',
fn: 'onViewportInitialize',
scope: this
}
]);
}


});

jjohnston
6 Apr 2012, 6:24 PM
Well, by the time the application's launch method runs, the viewport has already been created and its 'initialize' event has already fired. ;)

Is there a reason you want to attach to that particular event? It seems like it's not a useful event for the viewport since anything you'd put in its handler could just be put right in the launch method instead.

I'm not sure there's a way we can attach to that event before the viewport is created, but I'll look into it.

BostonMerlin
6 Apr 2012, 6:42 PM
Thanks Jason. My goal was to log out messages from the component chane of events to familiarize myself with the framework. Just bringing it to your attention as its an option that didn't work for me.

Love the bits you guys produce. Stay frosty. John