Undefined Ext for ExtJs

New for ExtJs. I looked at a bunch of threads but everything I try doesn't work. I am using ExtJS 4 and I keep getting and undefined Ext Error for the following code:

<html>
<head>

    <script type="text/javascript" src="/extjs/ext-all.js"></script>
    <script type="text/javascript" src="app.js"></script>
</head>
<body></body>
</html>

//app.js
Ext.application({
    name: 'HelloExt',
    launch: function() {
        Ext.create('Ext.container.Viewport', {
            layout: 'fit',
            items: [
                {
                    title: 'Hello Ext',
                    html : 'Hello! Welcome to Ext JS.'
                }
            ]
        });
    }
});

      

+3
extjs extjs4


source to share


4 answers


Check the ext-all.js path. Make sure the first slash is correct?



+2


source to share


Your browser was unable to load:

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

      

Which is next to a certain path question. So the following line:

Ext.application({

      



Will raise the error you are displaying (since there is no object in the scope Ext

).

Note that the extjs library path is relative to your index.html path

So if extjs

is a subfolder in the folder where index.html exists. You should really enable it using:

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

      

0


source to share


If your ext-all.js path is correct than try

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

      

0


source to share


If the problem only occurs in IE, just click ctrl+ F5to load the latest javascript in IE

0


source to share







All Articles
Loading...
X
Show
Funny
Dev
Pics