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

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


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

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

enabled: true

viewport: {
style: 'background-color:lightBlue;',
layout: {
animation: false,
type: 'card'

views: [
name: 'MyApp',
controllers: [

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

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

var login = Ext.create('MyApp.view.LoginContainer');
event: 'initialize',
fn: 'onViewportInitialize',
scope: this


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.

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

30 Jan 2015, 5:05 AM
hi try this snippet

Ext.Viewport.bodyElement.on('resize', rotate, this, { buffer: 1});