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 and inheritance. 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.

Sencha Architect 3.5

Guides
API
top

Using Navigation View in Mobile Apps

The Navigation View container is one of the most useful and versatile components in Sencha Touch 2. It allows you to easily create an interface where your user steps through a dynamic sequence of cards, while automatically maintaining a title bar and Back button for navigation.

This guide will show you how you can create and manipulate Navigation views within Sencha Architect to build a simple wizard-like interface. Launch a Sencha Touch project in Architect, set the URL Prefix, and save the project before following these instructions.

The completed project file for this tutorial can be found here

Core concepts

The most important thing to understand about Navigation View is that, unlike other card-layout components like Tab Panel, you almost never add multiple child cards into it initially. If you were to do so, the final card would be displayed by default.

Instead, you normally want to define the Navigation view with only one initial child card that displays first. Then, responding to certain user events, your app dynamically creates and pushes new child cards onto the view's navigation stack.

This means that you define each of the possible navigation cards as top-level components, independent from the Navigation view itself. Since they are created at the top level, they are defined as classes that can be instantiated individually.

It also means that you will need to use event handlers, write a small amount of JavaScript code to instantiate the cards, and push the cards onto the navigation stack. We will instantiate cards using their Xtype (also called userAlias in Architect), and will use the Navigation view Push method to add them to the navigation stack at the right time.

Create the cards

We'll start by defining each of the components that will become cards in the navigation. The first card will be called Step 1 and ask the user for a number. The second card will be called Step 2 and ask for a second number. The third card will be called Step 3 and let the user select a mathematical operator to perform a calculation.

Step 1 card

To create the first card:

  1. Drag a form panel from the toolbox onto the canvas.
  2. Set its userClassName config to Step1Panel.
  3. Set its userAlias to step1 -- we will use this value later on when referring to the Step1 Panel component by its xtype.
  4. Add a FieldSet to the form panel.
  5. Double-click the FieldSet's title, and change it to "Enter a number".
  6. Remove one of the fields.
  7. Select the remaining field, right-click it, and choose Transform > Ext.field.Number to turn it into a number field.
  8. Set the field's name config to number1 and clear its label config.
  9. Drag a button into the form panel.
  10. Double-click the button, and set its text to Next.
  11. Set the button's ui config to forward to give it a forward-pointing look.

Step 2 card

The second card will be very similar to the first card; rather than repeating everything from scratch we can simply right-click the Step1Panel and select Duplicate to save some time. Select the resulting duplicated component, and:

  1. Change its userClassName to Step2Panel.
  2. Change its userAlias to step2.
  3. Change its fieldset's title to Enter another number.
  4. Change its field's name to number2.

Step 3 card

The third card is also similar to the previous two, so create a duplicate of Step2Panel, then:

  1. Change its userClassName to Step3Panel.
  2. Change its userAlias to step3.
  3. Change its fieldset's title to Choose an operation.
  4. Change the button's text to Calculate!
  5. Since it's the final step, set the button's ui config to confirm.
  6. Remove the number field from the fieldset and add four Radio Button fields in its place.
  7. Set the name config for each of the radio buttons to operation so they will function as a single radio group.
  8. Give the first radio button a label of Add, and a value of add.
  9. Give the second radio button a label of Subtract and a value of subtract.
  10. Give the third radio button a label of Multiply and a value of multiply.
  11. Give the fourth radio button a label of Divide and a value of divide.
  12. Set the checked config of the first radio to true so it will be selected by default.

Creating the Navigation view

Now that we've defined the cards, let's create the Navigation view that will display them.

  1. Drag a Navigation View to the top level.
  2. Set its userClassName to MainNav.
  3. Right-click the navigation view in the Inspector and select Mark as Initial View so it displays immediately when the app starts up.
  4. The navigation view should display the Step 1 card by default, so drag Step1Panel onto MainNav in the Inspector and select Link; this creates a linked instance within the navigation view pointing to the Step1Panel.
  5. Select the new linked instance and set its title config to Step 1, which will be displayed in the navigation view's title bar.

Now that the application's view is created, let's add some behavior to it.

Controlling the navigation

Implement the behavior of the app by creating a controller. To add a controller to the project, click the add button ("+") at the top-right of the project Inspector and select Controller. Select the controller in the Inspector and set its userClassName to MainNavController.

Step 1 button action

Next create a controller action to handle the Next button in the Step 1 card:

  1. Select the controller, find the Actions config, and click its add button ("+") to add a new controller action.
  2. Choose Ext.Button as the target type.
  3. Choose tap as the event name.
  4. Select the new tap controller action in the Inspector.
  5. Change its fn config to onStep1SubmitTap.
  6. Change its controlQuery to step1 button. (This controlQuery is a Component Query Selector, which says to handle tap events for any button within the container with an xtype of step1.)
  7. Double-click the controller action in the Inspector and enter the following JavaScript code into the code editor:

     button.up('navigationview').push({
         xtype: 'step2',
         title: 'Step 2'
     });
    

This code says to find the navigationview ancestor of the button, and to Push a new Step2Panel card instance onto the end of the navigation stack, automatically animating it into view. We refer to the Step2Panel component class by its xtype which we assigned earlier by setting the Step2Panel's userAlias. We also give the new step2 instance a title of "Step 2" which will be displayed in the titlebar when this card is visible.

Step 2 button action

The controller action for the Step 2 button should be nearly identical. Follow the same steps as for the Step 1 button action, but:

  1. Set the controller action's fn config to onStep2ButtonTap.
  2. Set its controlQuery to step2 button.
  3. Change its handler code so it refers to Step 3 instead:

     button.up('navigationview').push({
         xtype: 'step3',
         title: 'Step 3'
     });
    

Step 3 button action

Follow the same steps to create a controller action for the Step 3 button, but:

  1. Set its fn to onStep3ButtonTap.
  2. Set its controlQuery to step3 button.
  3. For the handler code, double click the controller action in the Inspector and insert the following using the code editor:

     var mainNav = button.up('navigationview'),
         num1 = mainNav.child('step1').getValues().number1,
         num2 = mainNav.child('step2').getValues().number2,
         operation = mainNav.child('step3').getValues().operation,
         result;
    
     switch (operation) {
         case 'add':
             result = num1 + num2;
             break;
         case 'subtract':
             result = num1 - num2;
             break;
         case 'multiply':
             result = num1 * num2;
             break;
         case 'divide':
             result = num1 / num2;
             break;
     }
    
     Ext.Msg.alert('Your result is: ' + result);
    

In a nutshell, this code finds the forms for each step and asks for the values of their fields by name. It then performs the mathematical calculation by applying the chosen operator to the two entered numbers and displays the result in an alert popup.

Seeing it in action

The application is completely functional. Save and Preview the project to see it in action in your WebKit-based desktop browser or on your mobile device. Notice that as you progress through the steps, the Navigation View's title bar is automatically updated to display the title of the current card, and the Back button is automatically updated to allow you to go back to the previous step.

The Navigation view also supports some other useful options. For example, go to Architect and select the Navigation view and set its useTitleForBackButtonText config to true. Save and preview again and notice that the Back button now displays the title of the previous card rather than the static Back label.

You can also control the title bar at the top of the Navigation view by selecting it in the Inspector, finding its Navigation Bar item in Config, and click the add button. You can then select and configure the Navigation bar child, add additional items into it, and so on.

Now you have an understanding of how to create and manipulate Sencha Touch 2 Navigation View containers using Sencha Architect. You will find this very useful when creating common sequential UI navigation structures in your Touch apps.

Sencha Architect 3.5

Ext JS
Sencha Test
Cmd
Sencha Themer
GXT
IDE Plugins
Sencha Inspector
Architect
Sencha Fiddle
Touch
Offline Documentation

Sencha Test

2.0.1 2.0.0 1.0.3

Cmd

Cmd

Sencha Themer

1.1.0 1.0.2

GXT

4.x 3.x

IDE Plugins

IDE Plugins

Sencha Inspector

Sencha Inspector

Sencha Fiddle

Sencha Fiddle

Offline Documentation

Offline Documentation