View Full Version : Ext is not defined
hixson
5 Oct 2007, 2:46 PM
I was trying to get a simple tree example working and continued to get the message "Ext is not defined" in Firefox. I have paired this back to the absolute bare page that could make use of Ext (simply includes it):
<html>
<head>
<script type="text/javascript" src="http://mymachine.dev/js/ext-base.js"></script>
<script type="text/javascript" src="http://mymachine.dev/js/ext-all.js"></script>
</head>
<body>
Hello world!
</body>
</html>
Upon loading this page Firefox still says "Ext is not defined". It says this for ext-base.js on line 12 and ext-all.js on line 9.
What am I missing here? From the docs it looks like this is what I need to include on my pages in order to work with Ext.
I am getting the same behavior with both 1.1.1 and 2.0-alpha1.
Any help would be greatly appreciated.
SeaSharp
5 Oct 2007, 3:29 PM
Hi I started ExtJS programming this week and hit the same problem. As a workaround I added the following as the first JavaScript include before the 2 includes in your example:
<script type="text/javascript" src="ext/Ext.js"></script>
One benefit of this include of the sorter Ext.js file is the debug UI in Firebug feels faster when switching to the script tab because it opens the first include by default.
Like you I would like to know what the problem is because this made my first hour of ExtJS development frustrating.
Are you sure the addresses are correct? The best way to check is to use FireBug. Until you get it working, just put ext-base and ext-all in the same directory as your html page to make things easier.
SeaSharp
5 Oct 2007, 3:50 PM
Are you sure the addresses are correct?
Yes in my case I confirmed no 404's in the Firebug net trace. Adding the extra include sorted the page out. All 3 Ext .js files are loaded from the same local directory.
hixson
5 Oct 2007, 5:36 PM
Yes, the addresses are correct. Also, Firefox is telling me the line numbers at which the included files have errors.
tryanDLS
8 Oct 2007, 12:06 PM
Including ext.js as a separate file is not the solution to your problem - you can run into problems related to redefining objects.
Have you tried running the examples by simply changing the paths to the correct folder on your webserver?
In firebug, you should see the Ext js files in the Script tab if they are being loaded.
SeaSharp
9 Oct 2007, 1:55 AM
Have you tried running the examples by simply changing the paths to the correct folder on your webserver?
In firebug, you should see the Ext js files in the Script tab if they are being loaded.
The two JS files are there in Firebug and I can set breakpoints.
I also loaded Hixson's example page on my site, changed the Ext references to the local Ext directory and hit the same "Ext is not defined message". An additional reference to Ext.js prior to the other JavaScript includes sorted the problem as before.
I am running Visual Studio V9 (Orcas beta 2) and in a debug session studio defines the web address as http://localhost:1397/testWeb/... The web server is not IIS but something called ASP.NET development server visible on the task bar.
I am happy to conduct any other tests you require. It is strange that two new Ext developers hit the same basic problem in the same week.
It's obviously something small you're missing, post an example online somewhere.
hixson
9 Oct 2007, 9:22 AM
I found what was causing this. I simply had to include the ext-all.css file also.
<link type="text/css" rel="stylesheet" media="screen, print" href="/resources/css/ext-all.css"/>
<script type="text/javascript" src="/static/common/js/ext-base.js"></script>
<script type="text/javascript" src="/static/common/js/ext-all.js"></script>
I think it would really help newbies to Ext if the docs mentioned that you need to include ext-all.css, ext-base.js, and ext-all.js. The INCLUDE_ORDER.txt file mentions the .js files but not the .css file.
It could also be made more obvious that the images in the resources directory need to be kept in the same relative position to the .css files that make use of them. What I mean is that, for example, the tree stylesheet code wants to find its images in ../images/default/tree/ so you can't just put your .css files into just any directory you feel like.
Just these couple little details made throwing together a small test more frustrating than it could be.
Thanks for reading.
fpstudios
9 Oct 2007, 10:36 AM
I had the same issue, I just downloaded the ext-all.js and ext-base.js from the samples section http://extjs.com/deploy/ext-2.0-alpha1/examples/
Now it works fine on my RedHat server. I didn't have any problems with my Windows/Apache server.
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.