Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sencha ExtJS 4 - Basic hello world demo issues

Looking into ExtJS 4 and I am attempting to do the "Hello World" tutorial here: http://www.sencha.com/learn/getting-started-with-ext-js-4/

I have all my files setup as recommended in the tutorial:

enter image description here

But, I keep getting an error due to the funky syntax that starts their file:

enter image description here

I'm not using JQuery or any other libraries - since Sencha is supposed to be a complete javascript environment.

Here is the complete code:

app.js

<a href="#!/api/Ext-method-application" rel="Ext-method-application" class="docClass">Ext.application</a>({
    name: 'HelloExt',
    launch: function() {
        <a href="#!/api/Ext-method-create" rel="Ext-method-create" class="docClass">Ext.create</a>('<a href="#!/api/Ext.container.Viewport" rel="Ext.container.Viewport" class="docClass">Ext.container.Viewport</a>', {
            layout: 'fit',
            items: [
                {
                    title: 'Hello Ext',
                    html : 'Hello! Welcome to Ext JS.'
                }
            ]
        });
    }
});

index.html

<!doctype html>
<html>
<head>
    <title>Hello Ext</title>

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

Any ideas on what could be the culprit?

like image 201
PhillipKregg Avatar asked Jan 18 '12 19:01

PhillipKregg


People also ask

Is Sencha Ext JS free?

It is a free, limited commercial use license, with robust Ext JS Frameworks, hundreds of modern components, a material theme, and more to develop stunning-looking apps.

Is Ext JS still popular?

Even though ExtJS is well known among many coders, the technology is not globally spread. Nevertheless, this framework is most often used by big companies. They use the tool to develop production software and create other complex applications.


1 Answers

You're not supposed to have any HTML in a JS file. The code in the tutorial is screwed up. Those anchor href tags are links to ExtJS API documentation, that somehow got inserted into example code.

The actual code should be:

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

I've put up a bug report about that page here: http://www.sencha.com/forum/showthread.php?175129-Documentation-Getting-Started-with-Ext-JS-4.0&p=717098#post717098


Added Jan 21st, 2012: apparently the correct version of that tutorial is available at: http://docs.sencha.com/ext-js/4-0/#!/guide/getting_started

like image 77
Mchl Avatar answered Oct 01 '22 10:10

Mchl