PDA

View Full Version : Getting Error: Ext.onReady is not a function



rfresh
19 Jul 2008, 8:46 AM
I installed extJS and can copy some of the demos to my server and run them ok (although I get a lot of Declariation dropped warnings). Menus.html does not run like on the website demo page. When I copy the code onto my server and run menus.html I get the following screen display:
Toolbar with Menus

The js is not minified so it is readable. See menus.js (http://myinfodata.info/menus.js).

In other words, I don't actually see any of the menu images.

(1) I assume I don't have some path set correctly in my menus.html code?

(2) What does the minified statement mean?

Thanks...

evant
19 Jul 2008, 8:49 AM
1) Everything should just work out of the box, unzip it and that's it. Have you changed something?

2) Minifying means stripping out comments and unnecessary whitespace to make the file smaller to download. It can also mean replace variable names from longer ones to shorter ones.

For comparison, see ext-all.js vs ext-all-debug.js

rfresh
19 Jul 2008, 10:21 AM
No, I changed absolutely nothing in the menus.html file. I coped it from the examples folder into my editor and then I did an FTP upload from my editor to my severs public_html folder which is my 'root' folder where my .html files are.

I installed extJS into public_html/js/ext-2.1/ folders. The structure starts from there so public_html/js/ext-2.1/examples/menu/menus.html is my complete path. I have not edited the menus.html script at all.

Here is the difference that I can see:

mywebsite.com/js/ext-2.1/examples/menu/menus.html (http://mywebsite.com/js/ext-2.1/examples/menu/menus.html) runs the menus.html script fine - I can see the menus.

mywebsite.com/menus.html (http://mywebsite.com/menus.html) does not run it ok - I cannot see the menus. So there is some path modifications that I need to make so the images can be found on my server path structure correct?

Note 1: in my /examples folder there is a file called 'examples.jsb' but I do not see an 'examples.js' file. There is a line (23) in the menus.html file:



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


...but I don't see a shared folder in my path structure nor do I see the examples.jsb file.

Note 2: There is another line (13) in the menus.html file:

[php
<script type="text/javascript" src="../ext-all.js"></script>
[/php]

...but when I look in my ../js/ext-2.1/adapter/ext/ folder there is only one file in there: 'ext-base.js'. I see no file named 'ext-all.js'.

rfresh
19 Jul 2008, 6:09 PM
I'm trying to run the menus.html demo and I'm getting an error msg:

Error: Ext.onReady is not a function
Source File: http://mywebsite.com/js/ext-2.1/examples/menu/menus.js
Line: 9

The only changes I had to make was in lines 10 and 13 - they orginally had 'ext-all.js' but my installation (the latest from ext download page) does not have that filename, it has 'ext-base.js' so that is what I am using. I am not certain this is causing the error but since ext-all.js did not exist, I thought it right to edit the filename to the one that is in that folder:



<script type="text/javascript" src="../js/ext-2.1/adapter/ext/ext-base.js"></script>


Here is my complete menus.html file:



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Toolbar with Menus</title>
<link rel="stylesheet" type="text/css" href="../js/ext-2.1/resources/css/ext-all.css" />
<!-- GC -->
<!-- LIBS -->
<script type="text/javascript" src="../js/ext-2.1/adapter/ext/ext-base.js"></script>
<!-- ENDLIBS -->
<script type="text/javascript" src="../js/ext-2.1/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../js/ext-2.1/examples/form/states.js"></script>
<script type="text/javascript" src="../js/ext-2.1/examples/menu/menus.js"></script>
<link rel="stylesheet" type="text/css" href="../js/ext-2.1/examples/menu/menus.css" />
<!-- Common Styles for the examples -->
<link rel="stylesheet" type="text/css" href="../js/ext-2.1/examples/shared/examples.css" />
</head>
<body>
<script type="text/javascript" src="../js/ext-2.1/examples/shared/examples.js"></script><!-- EXAMPLES -->
<h1>Toolbar with Menus</h1>
<p>The js is not minified so it is readable. See <a href="../js/ext-2.1/examples/menu/menus.js">menus.js</a>.</p>
<div id="container">
<div id="toolbar"></div>
</div>
<br /><br /><br /><br /><br />
</body>
</html>

gpstatnon
19 Jul 2008, 6:15 PM
I suggest down loading 2.1 again as ext-all.js is most definately in the distribution.

mjlecomte
19 Jul 2008, 6:36 PM
Read the FAQ:
http://extjs.com/learn/Ext_FAQ#What_is_the_proper_include_order_for_my_JavaScript_files.3F

You haven't included the files correctly.

rfresh
19 Jul 2008, 7:22 PM
Read the FAQ:
http://extjs.com/learn/Ext_FAQ#What_is_the_proper_include_order_for_my_JavaScript_files.3F

You haven't included the files correctly.

I took the menus.html from the examples area - are you saying they don't have the correct incude order already? I don't know enough about ext to write an .html file on my own that includes using ext so that's why I chose to start with one of the samples: menus.html.

In any event, I read the link you provided and the INCLUDE_ORDER.txt file and I'm sorry to say I'm still lost - I don't know what that file means as it lists several JS framework files - I assume you only need one and I thought I was using the ext stand alone but now I'm not so sure of anything. Do I need yahoo and/or jquery and/or prototype as well in order to use ext?

(Sorry I'm so lost on this)

randcasburn
19 Jul 2008, 8:04 PM
Try this one instead...

Follow the instructions explicitly..don't skip steps. You'll be up and running in no time.

Here's the link...http://extjs.com/learn/Tutorial:Introduction_to_Ext_2.0

Randy

mjlecomte
19 Jul 2008, 8:27 PM
Well, if you download the framework, the zip file already includes all of the examples already packaged up. You should not be downloading anything individually.

evant
19 Jul 2008, 9:04 PM
Of course the first works and the second doesn't. If you're modifying the structure, then the include paths will be wrong.

There's no need for 2 threads about the same topic.

It's quite obvious your include order is wrong.

rfresh
19 Jul 2008, 9:08 PM
Well, if you download the framework, the zip file already includes all of the examples already packaged up. You should not be downloading anything individually.

I'm not downloading anything individually. I'm trying to install the ext code onto my server and then run the menus.html script from my server. I'm putting the menus.html script in my public_html folder because that's where my .php files will be run from and they will contain the .js code for ext.

As I stated before, I can run the menus.html file from it's examples folder ok but when I try to copy the menus.html file to my server home folder (public_html) it doesn't display the menus.

mjle is suggesting that I don't have the Order right but I'm lost on how to check this let alone correct it. I stated that I downloaded the menus.html file from the examples folder and it runs ok from the examples folder so I assume this means the include order is correct. The menus.html file does not run ok from my home (root) folder and I don't know why.

I downloaded the ext v2.1 again just now and looked in the adapter/ext folder and there is still only one file: ext-base.js. The menus.html example file is trying to load the file in the folder path ext-all.js and it's just not there - so how can the menus.html file run when clearly that file is not there?

rand - thanks for the tutorial tip - I looked at it and downloaded the lib yet again but I must be so stupid because that tutorial has you working on the .js file. Doesn't that code have to be inside an .html file in order to run it? And if so, doesn't there need to be some script tags to show where the .js and .css files are located in the ext JS lib? The tutorial has me working on the .js files but I can't run those to see how they work. So, once again I don't think that answers my orginal questions which I'm still stuck on and secondly, I don't under why the tutorial work is on a .js file that I can't run to see how it is working. Or maybe I should say I don't know how to run it as I thought I could only run a .html file in a browser.

In summry I am still completely lost and cannot understand where my problem is to fix and don't know how to fix it. I cannot believe getting this lib to work can be this difficult. I'm still at a loss to understand the Include Order relating to jquery, yahoo, etc.

I know you guys are trying to help me and I appreciate it very much but I'm still at ground zero and can't get started :(

rfresh
19 Jul 2008, 9:10 PM
I suggest down loading 2.1 again as ext-all.js is most definately in the distribution.

Where? I don't see it in the /adapter/ext/ folder where menus.html has a line calling for it. It's in line 13 calling for ext-all.js but I do not see that file in that folder - there is only one file: ext-base.js

rfresh
19 Jul 2008, 9:19 PM
Of course the first works and the second doesn't. If you're modifying the structure, then the include paths will be wrong.

There's no need for 2 threads about the same topic.

It's quite obvious your include order is wrong.

I am only modifying the ext JS paths.

My path is: public_html/js/ext-2.1/ lib in here

Are you saying I don't need to modify the paths? That moving the menus.html file into my public_html folder will allow the script to run correctly? If you are saying that, I already tried that and it did not run correctly (I could not see any menus).

>It's quite obvious your include order is wrong.

This the second time someone has told me this and I have responded that I do not know what this means or how to fix it. Telling me again doesn't help me to fix the problem when I don't understand what the problem is.

evant
19 Jul 2008, 9:21 PM
I can't understand why you're having so much trouble either.

1) Download the zip file.
2) Extract the zip file.
3) Upload the zip file to your server.
4) Navigate to http://YourServer/ext-2.1/examples/menu/menus.html

If that doesn't work, there is something screwy on your server. Check that the scripts are being included with firebug.

I can't tell you WHAT the paths are because I don't know how you've modified the directories. You don't include any DIFFERENT files, but you still need to POINT to the files that are already there.

gpstatnon
20 Jul 2008, 2:22 AM
ext-all.js will be in your public_html/ext-2.1/ folder its not in /adapter/ext/

if youve moved the menu.html from the examples folder to your document root youll have to modify every statement that includes the script and css

rfresh
20 Jul 2008, 10:48 AM
Thank you gp - that is exactly what I had to do. I also re-installed the extJS files but instead of installing in this path

/js/ext-2.1/ etc

I installed without the /js folder so its just /ext-2.1/ etc

I don't think that made a difference but putting the new paths in the script tags worked - now I can see the menu objects.

One last question if I may:

In FF3 I'm getting a lot of warings like this one below - probably 40 or 50 warnings - mosting the 'zoom' object at different locations in the ext-all.js file. Is this warning 'normal' or is there something I still have to tweak in my menus.html that I moved out of its examples folder and into my home folder. Thanks...



Warning: Unknown property 'zoom'. Declaration dropped.
Source File: http://myinfodata.info/ext21/resources/css/ext-all.css
Line: 17

gpstatnon
20 Jul 2008, 11:35 AM
I'm not great with css but so far as I know Firefox doesn't support the zoom selector/property in css. It's an IE only selector/property.

illuminum
20 Jul 2008, 11:42 AM
wrap it in jquery.



$((function() {
Ext.onReady(function() {
Ext.BLANK_IMAGE_URL = 'assets/ext/resources/images/default/s.gif';
Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
expires: new Date(new Date().getTime()+(1000*60*60*24*365)) // 1 year
}));
Ext.QuickTips.init();
window.pim = new PIM();
});
}));

watrboy00
20 Jul 2008, 12:05 PM
One last question if I may:

In FF3 I'm getting a lot of warings like this one below - probably 40 or 50 warnings - mosting the 'zoom' object at different locations in the ext-all.js file. Is this warning 'normal' or is there something I still have to tweak in my menus.html that I moved out of its examples folder and into my home folder. Thanks...



Warning: Unknown property 'zoom'. Declaration dropped.
Source File: http://myinfodata.info/ext21/resources/css/ext-all.css
Line: 17


This is because FF3 doesnt really recognize the zoom property.