Docs Help

Terms, Icons, and Labels

Many classes have shortcut names used when creating (instantiating) a class with a configuration object. The shortcut name is referred to as an alias (or xtype if the class extends Ext.Component). The alias/xtype is listed next to the class name of applicable classes for quick reference.

Access Levels

Framework classes or their members may be specified as private or protected. Else, the class / member is public. Public, protected, and private are access descriptors used to convey how and when the class or class member should be used.

Member Types

Member Syntax

Below is an example class member that we can disect to show the syntax of a class member (the lookupComponent method as viewed from the Ext.button.Button class in this case).

lookupComponent ( item ) : Ext.Component
protected

Called when a raw config object is added to this container either during initialization of the items config, or when new items are added), or {@link #insert inserted.

This method converts the passed object into an instanced child component.

This may be overridden in subclasses when special processing needs to be applied to child creation.

Parameters

item :  Object

The config object being added.

Returns
Ext.Component

The component to be added.

Let's look at each part of the member row:

Member Flags

The API documentation uses a number of flags to further commnicate the class member's function and intent. The label may be represented by a text label, an abbreviation, or an icon.

Class Icons

- Indicates a framework class

- A singleton framework class. *See the singleton flag for more information

- A component-type framework class (any class within the Ext JS framework that extends Ext.Component)

- Indicates that the class, member, or guide is new in the currently viewed version

Member Icons

- Indicates a class member of type config

- Indicates a class member of type property

- Indicates a class member of type method

- Indicates a class member of type event

- Indicates a class member of type theme variable

- Indicates a class member of type theme mixin

- Indicates that the class, member, or guide is new in the currently viewed version

Class Member Quick-Nav Menu

Just below the class name on an API doc page is a row of buttons corresponding to the types of members owned by the current class. Each button shows a count of members by type (this count is updated as filters are applied). Clicking the button will navigate you to that member section. Hovering over the member-type button will reveal a popup menu of all members of that type for quick navigation.

Getter and Setter Methods

Getting and setter methods that correlate to a class config option will show up in the methods section as well as in the configs section of both the API doc and the member-type menus just beneath the config they work with. The getter and setter method documentation will be found in the config row for easy reference.

History Bar

Your page history is kept in localstorage and displayed (using the available real estate) just below the top title bar. By default, the only search results shown are the pages matching the product / version you're currently viewing. You can expand what is displayed by clicking on the button on the right-hand side of the history bar and choosing the "All" radio option. This will show all recent pages in the history bar for all products / versions.

Within the history config menu you will also see a listing of your recent page visits. The results are filtered by the "Current Product / Version" and "All" radio options. Clicking on the button will clear the history bar as well as the history kept in local storage.

If "All" is selected in the history config menu the checkbox option for "Show product details in the history bar" will be enabled. When checked, the product/version for each historic page will show alongside the page name in the history bar. Hovering the cursor over the page names in the history bar will also show the product/version as a tooltip.

Search and Filters

Both API docs and guides can be searched for using the search field at the top of the page.

On API doc pages there is also a filter input field that filters the member rows using the filter string. In addition to filtering by string you can filter the class members by access level, inheritance, and read only. This is done using the checkboxes at the top of the page.

The checkbox at the bottom of the API class navigation tree filters the class list to include or exclude private classes.

Clicking on an empty search field will show your last 10 searches for quick navigation.

API Doc Class Metadata

Each API doc page (with the exception of Javascript primitives pages) has a menu view of metadata relating to that class. This metadata view will have one or more of the following:

Expanding and Collapsing Examples and Class Members

Runnable examples (Fiddles) are expanded on a page by default. You can collapse and expand example code blocks individually using the arrow on the top-left of the code block. You can also toggle the collapse state of all examples using the toggle button on the top-right of the page. The toggle-all state will be remembered between page loads.

Class members are collapsed on a page by default. You can expand and collapse members using the arrow icon on the left of the member row or globally using the expand / collapse all toggle button top-right.

Desktop -vs- Mobile View

Viewing the docs on narrower screens or browsers will result in a view optimized for a smaller form factor. The primary differences between the desktop and "mobile" view are:

Viewing the Class Source

The class source can be viewed by clicking on the class name at the top of an API doc page. The source for class members can be viewed by clicking on the "view source" link on the right-hand side of the member row.

Cmd 6.5.3


top

Integrating With Cordova or PhoneGap

Cordova

Apache Cordova provides APIs and packaging tools that create applications for Android, iOS, BlackBerry, and Windows Phone devices. Sencha Cmd 5+ provides a build system that supports multiple build profiles. This is ideal for native packaging. The Cordova Native Packager components have been updated to take full advantage of this feature.

PhoneGap

PhoneGap is built on top of Cordova and both have access to the Cordova API. PhoneGap and Cordova differ by how their packaging tools are implemented. PhoneGap provides a remote building interface at Adobe PhoneGap Build that lets you package and emulate an application for a single platform in the cloud. The PhoneGap Native Packager components have been updated to take full advantage of this feature.

Picking a Packager

When choosing between Cordova and PhoneGap, it's important to note a few things:

  • Cordova packaging tools let you build simultaneously for multiple platforms on your machine.
  • Cordova is constantly updated by the open source community, whereas PhoneGap updates are coordinated by Adobe.
  • PhoneGap provides a remote building application that eliminates the need for local building.

Using Sencha Cmd with Cordova and PhoneGap

Every app generated with Sencha Cmd has the ability to switch on native building through these services. Sencha Cmd will take care of all the repetitive tasks, such as building your app, getting it in the proper place for Cordova or PhoneGap, and running the proper commands to build, emulate, or run your application.

For more information on getting started with native development, please see the Apache Cordova Platform Guides. These guides provide getting started information and prerequisites needed to get your system up and running.

Important Notes

  1. packager.json has been fully removed. If your project still contains this file, you may safely remove it. This file was only used by Sencha's legacy Native Packager.

  2. For Cordova and PhoneGap, Sencha Cmd can only create DEBUG versions of applications, not a Release (for an app store) version. To create release versions, you must use a packager, such as Eclipse or IntelliJ for Android, and Xcode for iOS.

  3. You must have Java JRE 1.7 for the Sencha Cmd Cordova commands to work properly. While Sencha Cmd 6 on Windows and Mac OS X ship a current JRE in their default installers, the Cordova tools will not find and utilize Sencha Cmd's internal JRE.

Environment Setup

Before developing a Cordova or PhoneGap application, you will need to get your environment set up with the following software:

  1. Install Java JRE

  2. Install Node.js

  3. If you want to package and emulate with Cordova, install it with the following command:

     npm install -g cordova
    

    If you're on a Mac, you may need to include "sudo" in order to complete the installation.
    The command would then be:

     sudo npm install -g cordova
    

    Note: Whether or not you install Cordova to package and emulate your app, the Cordova API is available to your application. Cordova packaging and emulation does not affect the use of the Cordova APIs in a Cordova or PhoneGap app.

  4. If you want to package and emulate with PhoneGap, install it with the following command:

     npm install -g phonegap
    

    If you're on a Mac, you may need to include "sudo" in order to complete the installation.
    The command would then be:

     sudo npm install -g phonegap
    

    Note: You must register with the free Adobe PhoneGap Build site and obtain a username and password to access the PhoneGap remote building site.

  5. Download and install Sencha Cmd.
    For more information about this process, please check out the Cmd Intro Guide.

  6. Check and satisfy target device platform-specific requirements:

    Android: Download and install the Android SDK Manager.

    Blackberry: Review the BlackBerry Native SDK and register to sign your apps with the BlackBerry Keys Order Form.

    iOS: Complete all of the steps for iOS provisioning on the Apple iOS provisioning profiles portal (requires an Apple ID, password, and a purchased developer license). Use this site to obtain a certificate, identify devices, and get an AppID.

    In addition, download and install the free Xcode software. You can use the Xcode simulator to debug your iOS app before installing it on a device. Xcode only works on a Mac with Lion, Mountain Lion, or Mavericks OS X.

config.xml

When you create a PhoneGap or Cordova app, they will both will create a config.xml file for your project.

Cordova stores config.xml in your "app_root/cordova" folder, while PhoneGap stores the config.xml file in your "app_root/cordova/www" folder. This is a problem because the www folder is the destination for the compiled build. It is very likely that this www folder will get deleted and wipe out the config.xml file.

To remedy this in Sencha Cmd, we copy the config.xml file to the root of the PhoneGap project when a PhoneGap application is created. Every time you do a build, we then copy it back into the www folder along with the compiled application. This means that users can expect the config.xml file to be in the root of the Cordova or PhoneGap folder regardless of which framework you use.

For more information about configuring PhoneGap and Cordova, please review the following resources:

Developing a Cordova App

Create your application using the Cmd generate command as follows:

 sencha -sdk /path/to/Framework generate app MyApp /path/to/MyApp

When developing an Ext 6+ universal application the generated application will already contain a builds block in app.json. When your application already contains a builds block the sencha phonegap/cordova init command will not be able to add modify your app.json. To add Cordova support please modify your applications app.json builds block as follows:

"builds": {
    "classic": {
        "toolkit": "classic",
        "theme": "theme-triton"
    },

    "modern": {
        "toolkit": "modern",
        "theme": "theme-cupertino",
        "packager": "cordova",
        "cordova": {
            "config": {
                "platforms": "ios",
                "id": "com.mydomain.MyApp"
            }
        }
    }
}

Navigate to your newly generated project folder and run one of the following commands (APP_ID and APP_NAME arguments optional).

sencha phonegap init com.mycompany.MyApp MyApp

or

sencha cordova init com.mycompany.MyApp MyApp

You should now see a phonegap or cordova directory in the project folder after the above command completes.

You should also see a block for PhoneGap or Cordova in your project's app.json file. app.json is located at the root of your project. This is where you can set the platform for which you are building.

A build object similar to the following should now be present in your app.json file.

"builds": {
    "native": {
        "packager": "cordova",
        "cordova" : {
            "config": {
                "platforms": "ios",
                "id": "com.mydomain.MyApp"
            }
        }
    }
}

Let's talk a bit about the above code snippet.

Build Name

It is worth noting that the word "native" is simply your build's name and can be anything you like. Build names must be a single string, containing only alphanumeric characters with no spaces. For example you could have a build name like "ios", "android", "iphone", "ipad", etc..

Note: While you may choose anything for a build name, the names "production", "testing" and "development" are reserved by Sencha Cmd and should not be used in this context.

Platforms

You can then set the platforms object to be any platform, or combination of platforms. For Cordova, you can specify a space delimited list, for example "ios android".

ID

The "id" property will be used when the Cordova application is first generated. This will be the identifier for your application. That said, you will want to make sure you have picked this correctly. If you need to change it, you will want to delete the Cordova folder from your project and let Cmd regenerate it after you have changed the ID property. This is especially important for iOS application as this must match your Bundle Identifier.

From the terminal or command line run the following command:

sencha app build {build-name}

Where {build-name} is one of the names defined in the build object of your app.json file. For example if you called your build "android" the command would be:

sencha app build android

That's it! Sencha Cmd will now create a Cordova application and build the platform you specified via the platforms property in app.json.

Sencha Cordova Commands

There are 4 commands you are able to use with Cordova and this new build object.

Build

sencha app build {build-name}

"build" will build your Sencha application and then build a native application.

Run

sencha app run {build-name}

"run" will build your Sencha application and your native application. It will then attempt to run it on a connected device.

Emulate

sencha app emulate {build-name}

"emulate" will build your Sencha application and your native application. It will then attempt to run it in a emulator.

Prepare

sencha app prepare {build-name}

"prepare" will build your Sencha application, then prepare the built application into the native app. However, it will not build the native portion. This is good if you need to inject things into your application after sencha compile and before the native build.

Developing a PhoneGap App

PhoneGap is very similar to Cordova. In fact, the process is almost identical if you are not building via the PhoneGap cloud services.

Here is a snippet for app.json that would give you a PhoneGap project identical to the Cordova project above.

"builds": {
    "native": {
        "packager": "phonegap",
        "phonegap" : {
            "config": {
                "platform": "ios",
                "id": "com.mydomain.MyApp"
            }
        }
    }
}

There are only a few minor, but important, differences.

  • The name changes from "cordova" to "phonegap".

  • "platform" is singular not "platforms". PhoneGap only allows you to build one local platform at a time, whereas Cordova allows for multiple simultaneously.

Once you recognize these small differences, it's the same commands as above. You can simply run sencha app build native or sencha app run native and you will be on the same path as Cordova.

Sencha PhoneGap Commands

There are 3 commands you may use with PhoneGap and this new build object. PhoneGap does not support the prepare command found in Cordova. sencha app prepare native will throw an error if you are using PhoneGap. The other three are the same as the Cordova commands above.

Build

sencha app build {build-name}

"build" will build your sencha application and then build a native application.

Run

sencha app run {build-name}

"run" will build your sencha application and your native application. It will then attempt to run it on a connected device.

Emulate

sencha app emulate {build-name}

"emulate" will build your sencha application and your native application. It will then attempt to run it in a emulator.

Developing a Remote PhoneGap App

Building your PhoneGap application in the cloud has numerous advantages. You do not need to go through the normal hassle of downloading all the SDKs and tools for your machine. You can simply send your web app to the PhoneGap servers and Adobe will generate a native application for you.

Before you get started with Sencha Cmd and remote building, you will want to visit http://build.phonegap.com and sign up for a free account.

You can test the build process by simply uploading a zip that contains a index.html file. PhoneGap Remote Build will then package it for you.

If you are building for iOS, you will need to follow the instructions on the site to add the proper credentials to build your application.

Once you feel confident that your account is setup and you have all the correct files uploaded to Adobe, you can quickly add remote building to your Sencha workflow.

Let's take a look at a build object for remote deployment.

"builds": {
    "native": {
        "packager": "phonegap",
        "phonegap" : {
            "config": {
                "platform": "ios",
                "remote": true,
                "id": "com.mydomain.MyApp"
            }
        }
    }
}

As you can see, it is very simple to switch from local to remote building. All you need to do is add the remote flag to your app.json builds block.

The next step is to provide your username and password so that Sencha Cmd can automatically log you in to the PhoneGap remote servers and upload your project.

To do this, we recommend adding a local.properties file to your application's root. For security purposes, this properties file should be ignored by all forms of version control.

Add the following lines to that file:

[email protected]
phonegap.password=s3nch@isgr3@t

Once you have configured your username and password, sending off a build is simple. Just run sencha app build native and your application will be compiled and shipped up to the cloud for Adobe to generate your native application.

After the build is complete, you may access the final package file through the PhoneGap portal for testing on devices, or for uploading to applicable app stores.

Cmd 6.5.3