PDA

View Full Version : Code generated from Designer 2 works on WebServer but has problems for local files



chulochula
13 Feb 2012, 1:50 AM
I used Sencha Touch with PhoneGap. Recently I am very happy to try out the Sencha Designer 2.x

All work fine when I run the codes with HTTP protocol. I managed to make it run on local files (what PhoneGap requires) but came into

Error: [Ext.Loader] Failed loading synchronously via XHR: 'app/view/Viewport.js'; It's likely that the file is either being loaded from a different domain or from the local file system whereby cross origin requests are not allowed due to security reasons. Use asynchronous loading with Ext.require instead.

Could you please help me a bit? (I used ST 1.1.1, first time use 2.0 beta)

aconran
13 Feb 2012, 10:36 AM
When using dynamic loading, the application has to be running over http.

Building the application into a single file will eliminate the need for dynamic loading. Check out Sencha SDK Tools which will help you do custom builds.

chulochula
13 Feb 2012, 6:39 PM
When using dynamic loading, the application has to be running over http.

Building the application into a single file will eliminate the need for dynamic loading. Check out Sencha SDK Tools which will help you do custom builds.

Thanks for the direction. I will take time to view that topic.

BTW, after searching the Forum, I found if I add "requires: ['app.view.Viewport']" to designer.js, it works perfectly for local files. The only problem is that it will be overwritten when the project re-Deploy. I wonder if I could define it somewhere in the Designer project.

kveeiv
14 Feb 2012, 7:33 AM
You can do this by selecting Application from the Project Inspector, then in the Component Config panel, the Ext.app.Controller section, you can add "Viewport" to the "views". This will invoke the appropriate requires.

In my opinion, I think this Viewport is automatically created by Designer, and therefore should automatically be added to the configuration just as other new MVC classes are.

chulochula
17 Feb 2012, 7:32 PM
You can do this by selecting Application from the Project Inspector, then in the Component Config panel, the Ext.app.Controller section, you can add "Viewport" to the "views". This will invoke the appropriate requires.

In my opinion, I think this Viewport is automatically created by Designer, and therefore should automatically be added to the configuration just as other new MVC classes are.

Very thanks, kveeiv. It solved my problem.