PDA

View Full Version : Dynamic loading weirdness



lisper
20 Aug 2011, 2:39 PM
I'm at the very beginning of climbing the extjs learning curve. Looking at:

[My root URL]/extjs/docs/index.html#/guide/getting_started

I can run the tiny example on that page and it works. But the docs say:

You should see a warning in the console that looks like this:
http://localhost/~ron/extjs/docs/guides/getting_started/loader-warning-viewport.png

I do not see that warning. And when I add the line that the docs suggest:

Ext.require('Ext.container.Viewport');

The app stops working with the following error:

TypeError: Result of expression 'c' [null] is not a constructor.

Is this an indication that I'm doing something wrong, or just the docs lagging behind reality? I'm running a fresh install of extjs 4.0.2a. Thanks!

raz0r1
21 Aug 2011, 9:14 PM
I think it lagging behind. I don't get the message , too;)

christocracy
22 Aug 2011, 4:42 AM
Show me the html file you're using to boot your application.

When you see weird variable names like "c is undefined", this mean you're probably using the deployment version of the library, which is minified to reduce file-size in a production environment.

In a development environment, you want to use the unminified version of the library which provides much more helpful error messages.

lisper
22 Aug 2011, 5:14 AM
<html>
<head>
<title>Hello Ext</title>


<link rel="stylesheet" type="text/css" href="../extjs/resources/css/ext-all.c\
ss">
<script type="text/javascript" src="../extjs/ext-debug.js"></script>
<script type="text/javascript" src="app.js"></script>
</head>
<body></body>
</html>

christocracy
22 Aug 2011, 6:35 AM
Ok, you're using ext-debug.js.

Can you show me a screenshot of the stack-trace in chrome?

lisper
22 Aug 2011, 7:43 AM
I may need a clue about how to do that. This is the result of my best effort, but it sure doesn't look right to me.

27608

skirtle
22 Aug 2011, 9:10 PM
Open the JS console (ctrl+shift+J). Note you must have the console open when the error occurs to get a stacktrace.
Reload the page or do whatever else it is you do to cause the error.
To the left of the error message you'll see a small, solid, gray arrow. Click it. That should expand out the stacktrace.

lisper
22 Aug 2011, 9:57 PM
Thanks! That is far from intuitively obvious. Here's the backtrace:

27630

lisper
28 Aug 2011, 9:45 AM
I think I figured it out. The problem was that the call to Ext.require was inside my application.launch function. When I move it outside the launch function it seems to work.