Sencha Touch - First Program


In this chapter, we will list down the steps to write the first Hello World program in Ext JS.

Step 1

Create an index.htm page in an editor of our choice. Include the required library files in the head section of html page as follows.


<!DOCTYPE html>
      <link href = "" rel = "stylesheet" />
      <script type = "text/javascript" src = "">
      <script type = "text/javascript">
         Ext.application( {
            name: 'Sencha', launch: function() {
               Ext.create("", {
                  fullscreen: true, items: [{
                     title: 'Home', iconCls: 'home', html: 'Welcome to sencha touch'


  • Ext.application() method is the starting point of Sencha Touch application. It creates a global variable called 'Sencha' declared with the name property - all the Application's classes such as its Models, Views and Controllers will reside under this single namespace, which reduces the chances of colliding global variables and file names.

  • launch() method is called once the page is ready and all the JavaScript files are loaded.

  • Ext.create() method is used to create an object in Sencha Touch. Here, we are creating an object of simple panel class

  • is the predefined class in Sencha Touch for creating a panel.

  • Every Sencha Touch class has different properties to perform some basic functionalities.

Ext.Panel class has various properties such as −

  • fullscreen property is to make use of a complete screen, hence the panel will take fullscreen space.

  • items property is the container for various items.

  • iconCls is the class used for displaying different icons.

  • title property is to provide the title to the panel.

  • html property is the html content to be shown in the panel.

Step 2

Open the index.htm file in a standard browser and you will get the following output.