View Full Version : PR4: Ext.application autoCreateViewport gone?

24 Jan 2012, 1:30 PM
Using PR3, we had autoCreateViewport, but it does not appear to be working in last night's release. I also don't see it in the docs, but there was no mention of it being removed in the release notes. Is this gone temporarily, or permanently?

Thanks for the great work! ST2 is much improved over ST1.


24 Jan 2012, 2:59 PM
Hey Alex, looks like I forgot the deprecation warning on this one. I've taken autoCreateViewport out because it was not really adding any value (replacing a 1-liner with another 1-liner), was confusing some people and also breaks the definition of what the Viewport class does in Sencha Touch 2.

I'll add a warning into the Application class that tells you how to get around this, but basically you just need to have a launch function in your application:

launch: function() {

24 Jan 2012, 3:05 PM
Thanks for the quick response! I can live with that ;-)

I also found a reference in the Viewport class (http://dev.sencha.com/deploy/sencha-touch-2-pr4/docs/#!/api/Ext.Viewport) in the docs, but I'm not sure if there is any value add:

Ext.application (http://dev.sencha.com/deploy/sencha-touch-2-pr4/docs/#!/api/Ext-method-application)({
launch:function(){//do something}

Thanks for the help

24 Jan 2012, 5:13 PM
You probably shouldn't do that, as it removes all the special viewport functionality that is in Ext.viewport.Default, Ext.viewport.Ios and Ext.viewport.Android.

26 Jan 2012, 1:49 PM
I tried using

Ext.application({ launch: function() { Ext.create('MyApp.view.Main'); }});

But I get a blank screen, no warnings or errors. If I were to take what is defined in the MyApp.view.Main and call that in the application launch it works, for example:

Ext.application({ launch: function() { Ext.create('Ext.Container', { fullscreen: true,
html: 'HELLO WORLD!'

What am I missing?

26 Jan 2012, 2:59 PM
Found my problem, I had

initialize: function () {
console.log('initialize main view');

in my main view. I removed it and it works as expected.

26 Jan 2012, 3:27 PM
To make that work you'll just need to make sure you callParent from you initialize function:

initialize: function() {

console.log('initialize main view');