PDA

View Full Version : Uncaught ReferenceError: Ext is not defined



mlotfi
3 Mar 2013, 8:01 PM
Hi,
I just started learning Ext Js, I bought the book : Learning Ext JS 4, I have xampp installed in my mac, when I tried to test the first example in chapter 2 :



<!-- Importing the stylesheet for the widgets -->
<link rel="stylesheet" type="text/css" href="../extjs-4.1.1/resources/css/ext-all.css">
<!-- Importing the Ext JS library -->
<script type="text/javascript" src="../extjs-4.1.1/ext-all-dev.js"></script>

<!-- Importing the client class -->
<script type="text/javascript" src="js/Client.js"></script>



http://localhost/learning-extjs-4/Chapter 2/02-concepts/01-class.htm
I got thse erors in the console :

GET http://localhost/learning-extjs-4/Chapter 2/extjs-4.1.1/resources/css/ext-all.css 404 (Not Found)

GET http://localhost/learning-extjs-4/Chapter 2/extjs-4.1.1/ext-all-dev.js 404 (Not Found)

Uncaught ReferenceError: Ext is not defined

evant
3 Mar 2013, 9:28 PM
Pretty much exactly what it says. The paths to the css/js are wrong. You need to fix them up.

mlotfi
4 Mar 2013, 3:47 AM
My files are in :

XAMPP\htdocs\learning-extjs-4\Chapter 2\02-concepts\01-class.html

XAMPP\htdocs\learning-extjs-4\extjs-4.1.1

so what's wrong with these lines :



<!-- Importing the stylesheet for the widgets -->

<link rel="stylesheet" type="text/css" href="../extjs-4.1.1/resources/css/ext-all.css">

<!-- Importing the Ext JS library -->

<script type="text/javascript" src="../extjs-4.1.1/ext-all-dev.js"></script>

<!-- Importing the client class -->

<script type="text/javascript" src="js/Client.js"></script>

AssetWorks
4 Mar 2013, 8:48 AM
If your HTML is in 02-concepts folder your code is saying that move back one folder so now you are in chapter 2 folder when you want to be back into learning-extjs-4 folder so in your HTML change ../ to ../../ to in both CSS ref and the ext lib ref

mlotfi
4 Mar 2013, 9:13 AM
Thanks lot AssetWorks (http://www.sencha.com/forum/member.php?545037-AssetWorks).

Mahi993
5 May 2014, 11:11 PM
I am facing similar issue with resolving the res paths. I have attached relevant screenprints here. Any help would really be appreciated.

jsakalos
5 May 2014, 11:42 PM
Do you generate the app with Sencha Cmd? If yes, then you should not have any problems. If not, maybe this video can help you:http://extjs.eu/videos/#create-workspace

Mahi993
6 May 2014, 2:38 AM
yes jsakalos, I have generated the app using 'sencha generate app' command. I am using ext-JS GPL version. I am not sure if the location from where the server is started matters here. because I am referring a file outside the server directory. But if you notice the error message, its looking for that res as "localhost:1841/ext/ext-dev.js". Does that mean it is expecting the resource to be copied to the server?

jsakalos
6 May 2014, 12:50 PM
Try to start the server from the workspace directory; I'll check that too later today.

Mahi993
6 May 2014, 11:01 PM
I have tried starting the server from workspace folder, but the issue persists. Kindly help me as I am new to ExtJS. Came here with lot of enthusiasm and stuck with this issue :s. I am using 'ext-4.2.1-gpl' & 'SenchaCmd-4.0.4.84-windows' software. Please suggest if I have to use other versions; its only for self study purpose.

I also noticed that this software is not copying ext/resources folder from SDK to newly generated app folder, while using 'generate app' command. I manually had to copy those files. People on the web says its been fixed in latest releases, but I think ext-4.2.1 is the latest software.

jsakalos
7 May 2014, 1:01 AM
A couple of notes:
Normally, you run a http server on your development machine. Watch these videos to find out how to prepare your PC for Ext development: http://extjs.eu/videos
If you really cannot instal a http server then you can use "sencha web start" in the workspace - I've tried it and it works, however, you need to build your app first with "sencha app build" from the application directory
resources are not copied during "sencha generate app" but during "sencha app build"