PDA

View Full Version : First Look - Got 2 warnings errors



biggbest
8 Feb 2012, 2:28 PM
Hi,

I've just downloaded the Sencha Designer Beta, made the First Look app, but I got 2 warnings :

[Ext.Loader] Synchronously loading 'CityBars.view.Viewport'; consider adding Ext.require('CityBars.view.Viewport') above Ext.onReady sencha-touch-all-debug.js:6292

Ressource interprétée comme Script mais transférée avec un type MIME text/plain. business_review_search:-1

Is someone already got these errors ? :-(

aconran
8 Feb 2012, 4:52 PM
These are both warnings that can safely be ignored. The first one, the designer should be adding an additional require. We will fix that.

THe second one is because Yelp didnt set their mime type as javascript when transferring data over JSONP.

biggbest
9 Feb 2012, 1:43 AM
Oh well ok, but the fact is that nothing appear on the screen, except the title (and gray background). :(

aconran
9 Feb 2012, 9:35 AM
Do you have an initial view set?

Would you post the project you are having problems with?

hazelize
9 Feb 2012, 1:06 PM
In testing within the browser the citybars application, the package I downloaded from you guys, it just shows a gray background, citybars as the title, and it retrieves my location, but nothing else happens.

Actually, I get these errors on top of those warnings...

XMLHttpRequest cannot load file:///...citybars/app/view/Viewport.js?_dc=1328821478827 (file:///Users/admin/Documents/JohnHazel/citybars/app/view/Viewport.js?_dc=1328821478827). Cross origin requests are only supported for HTTP.

sencha-touch-all-debug.js:7826
(http://extjs.cachefly.net/touch/sencha-touch-designer-edition/sencha-touch-all-debug.js)Uncaught 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.

hazelize
9 Feb 2012, 1:26 PM
Fixed it. I guess my local file system doesn't allow the AJAX due to security reasons like the error said, so I uploaded it to our server and tested it online and it works fine

aconran
9 Feb 2012, 3:02 PM
Fixed it. I guess my local file system doesn't allow the AJAX due to security reasons like the error said, so I uploaded it to our server and tested it online and it works fine
That is correct, you need to run this via the http protocol.

Phil.Strong
10 Feb 2012, 8:21 AM
Also be sure to update the getBusinesses function in your Business Controller to include your own yelp api key

trinitrotoluen
12 Feb 2012, 7:58 AM
That is correct, you need to run this via the http protocol.
I'm facing this issue too when I opened the file directly (not via webserver). The problem is I want my app working when I'm using it with phonegap framework ? How to manage this problem because I have no problem with ST 1.x ?

trinitrotoluen
12 Feb 2012, 11:19 AM
just found it :D , I have to use 'requires' to include the component


requires: [
'Ext.form.Panel','Ext.form.FieldSet','Ext.field.Password'
]

Pine
13 Feb 2012, 3:51 PM
just found it :D , I have to use 'requires' to include the component

Where exactly did you add the 'requires' part?
Is this your only change and it works fine?

trinitrotoluen
13 Feb 2012, 4:51 PM
Where exactly did you add the 'requires' part?
Is this your only change and it works fine?

Sencha designer by default generate code using synchronous loading approach so my apps need a web server to run properly, if you want your app running without webserver you have to change your loading approach to asynchronous by explicitly using 'requires' in your class. More detail check : http://docs.sencha.com/ext-js/4-0/#!/api/Ext.Loader

Example :


Ext.define('Blabla.view.loginForm', { extend: 'Ext.form.Panel',
requires: [
'Ext.form.Panel','Ext.form.FieldSet','Ext.field.Password'
]
....


CMIIW