Hybrid View
-
8 Aug 2011 8:34 AM #1
[1.1.0] Ext.regApplication is not compatible with application profiles
[1.1.0] Ext.regApplication is not compatible with application profiles
If you are using application profiles and Ext.regApplication there is a bug in Ext.Contoller.render()...
The bug is in setting a local variable profile as either the current profile string or the current application instance.
It then calls profile.getRenderTarget() which will obviously fail when the profile is set to a string!
See attached code (renamed to .js.txt for the uploader) for an example of the bug.
Work around if you still want to use profiles, use either:
orCode:MyApp = new Ext.Application({ ... });
Cheers,Code:MyAppDefinition = Ext.extend(Ext.Application, { ... }); MyApp = new MyAppDefinition();
Cathy
bug.js.txt
-
25 Oct 2011 7:06 AM #2
Hello,
I have the same problem and I'm interested to know if there is any solution to keep the "Ext.regApplication" (for MVC) and still use "profiles:".
If I use any of your suggestions (new Ext.Application - or - Ext.extend(Ext.Application...)) then I will not be able to keep the current MVC structure of the application since I get the following error:
"Uncaught TypeError: Cannot read property 'viewport' of undefined"
I guess this means my viewport is not visible in Controllers anymore.
Thanks,
-
26 Oct 2011 12:53 AM #3
It's the controller that is missing a reference to the app.
You set it manually as follows:
In the Application
Then in the Controller methodCode:launch: function() { // load styles by device Ext.Mobile.loadDeviceStylesheet('aps','pth'); Ext.Mobile.log('app launched ... '); Ext.dispatch({ controller: 'MainController', action: 'doLaunch', app: this }); },
Code:doLaunch: function(params){ // set up reference to application since we can't use regApplication this.app = params.app; // etc etc .... },
-
26 Oct 2011 1:20 AM #4
Detailed project structure
Detailed project structure
Hello Cathy,
I tried the solution you suggested but I get the same error, maybe is something that I'm doing wrong or maybe my application structure is different, here you may see it:
File: App.js
File: HomeController.jsCode:Ext.regApplication({ name: 'MyApp', defaultUrl: 'Home/index', launch: function() { // Init the Viewport this.viewport = new MyApp.views.Viewport(); }, profiles: { portraitPhone: function() { return Ext.is.Phone && Ext.orientation == 'portrait'; }, landscapePhone: function() { return Ext.is.Phone && Ext.orientation == 'landscape'; }, portraitTablet: function() { return !Ext.is.Phone && Ext.orientation == 'portrait'; }, landscapeTablet: function() { return !Ext.is.Phone && Ext.orientation == 'landscape'; } } });
I have changed in "App.js" the "Ext.regApplication" to "new Ext.Application" and added your code to "launch:" (of course changing the controller name).Code:Ext.regController('Home', { // Index action index: function(options) { if (!this.indexView) { this.indexView = this.render({ xtype: 'HomeIndex' }); } this.application.viewport.setActiveItem(this.indexView, options.animation); } });
Then, in "HomeController.js" I have added your code for "doLaunch" and I still get the same error after I access the application in Google Chrome:
Uncaught TypeError: Cannot read property 'viewport' of undefined (HomeController.js:10)
This line here:
Code:this.application.viewport.setActiveItem(this.indexView, options.animation);
-
28 Oct 2011 1:37 AM #5
Hiya,
Try changing theses lines in the controller doLaunch method
toCode:// set up reference to application since we can't use regApplication this.app = params.app;
You can see in the error message you get that in the Controller (this) it is failing to find a reference to this.application not this.app as I had in my snippet.Code:// set up reference to application since we can't use regApplication this.application = params.app;
Hint - in Chrome debugger in the Script panel you can set a break point to trigger before an exception is thrown - allowing you to inspect the relevant objects.
http://code.google.com/chrome/devtools/docs/scripts-breakpoints.html#js_exceptions
Good luck!
Cathy
-
28 Oct 2011 1:49 AM #6
Hey Cathy
Hey Cathy
Hey Cathy,
Thanks for your time, help and hint. I will give it a shot later this afternoon and I will let you know if it works.
Thank you again for your time,
Luigi,
-
5 Mar 2012 8:03 AM #7
-
5 Mar 2012 8:18 AM #8
There is no update, I believe this was abandoned in favor of ST2 which btw does not implement setProfile. You really need to roll your own solution with this. I'd recommend that you go the route of ST2 which handles the orientation change better. See: http://www.sencha.com/forum/showthre...ntation-Change
-
5 Mar 2012 9:14 AM #9
Thank you jnotti, i believe you are right and 1.x branch is abandoned.
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote

