Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7458569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T13:27:53+00:00 2026-05-29T13:27:53+00:00

I have two views. The User view has some text and a button. I

  • 0

I have two views. The User view has some text and a button. I want to use that button to switch to the second view. But i don’t know how this works with sencha touch 2. When i press the button on the “UserView” (which is the first view), then i get the following error:

Uncaught Error: SYNTAX_ERR: DOM Exception 12

This is basically how my code looks right now:

app.js

Ext.Loader.setConfig({ enabled: true });

Ext.setup({
    viewport: {
        autoMaximize: false
    },
    onReady: function() {
        var app = new Ext.Application({
            name: 'AM',
            controllers: [
                'Main'
            ]
        });
    }
});

The Main controller

Ext.define('AM.controller.Main', {
    extend: 'Ext.app.Controller',
    views : ['User'],
    init: function() {
        this.getUserView().create();

        this.control ({
            '#new': {
               tap: function() {
                    alert('aaaa');
               }
            }
        });
    }
}); 

And the two views:

Ext.define('AM.view.User', {
    extend: 'Ext.Container',
    config: {
        fullscreen:true,
        items: [{
                xtype: 'button',
                text: 'New',
                id: 'new'
            }
        ],
        html: 'Testing<br />'
    }
}); 

2nd view

Ext.define('AM.view.New', {
    extend: 'Ext.Container',
    config: {
        fullscreen: true,
        html: 'w00t'
    }
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T13:27:54+00:00Added an answer on May 29, 2026 at 1:27 pm

    Here is your application written the way it should be. Here are a few notes about the changes I made:

    • You should call Ext.application instead of Ext.setup when creating your MVC application.
    • All root views should be defined inside your app.js.
    • You no longer need to use this.control() in your controllers. You can simply use the control configuration in the config block.
    • You should define all views in the views config of Ext.application.
    • Instead of creating the view in init, do it in launch. This is components should be added into the view.

    app/view/User.js

    Ext.define('AM.view.User', {
        extend: 'Ext.Container',
    
        config: {
            items: [
                {
                    xtype: 'button',
                    text: 'New',
                    id: 'new'
                }
            ],
            html: 'Testing<br />'
        }
    });
    

    app/view/New.js

    Ext.define('AM.view.New', {
        extend: 'Ext.Container',
        config: {
            html: 'w00t'
        }
    });
    

    app/controller/Main.js

    Ext.define('AM.controller.Main', {
        extend: 'Ext.app.Controller',
    
        config: {
            control: {
                '#new': {
                    // On the tap event, call onNewTap
                    tap: 'onNewTap'
                }
            }
        },
    
        launch: function() {
            // When our controller is launched, create an instance of our User view and add it to the viewport
            // which has a card layout
            Ext.Viewport.add(Ext.create('AM.view.User'));
        },
    
        onNewTap: function() {
            // When the user taps on the button, create a new reference of our New view, and set it as the active
            // item of Ext.Viewport
            Ext.Viewport.setActiveItem(Ext.create('AM.view.New'));
        }
    });
    

    app.js

    Ext.application({
        name: 'AM',
    
        // Include the only controller
        controllers: ['Main'],
    
        // Include all views
        views: ['User', 'New'],
    
        // Give the Ext.Viewport global instance a custom layout and animation
        viewport: {
            layout: {
                type: 'card',
                animation: {
                    type: 'slide',
                    direction: 'left',
                    duration: 300
                }
            }
        }
    });
    

    I also suggest you checkout the great guides over on the Sencha Touch API Docs, as well as checking out the Sencha Forums as they are very active and are a great source of information.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app that has a centre view with two views off to
I have two views of some data: a list view (a ListBox now, but
I have two views, one view takes the whole screen, the second view covers
In short: I want to have two fullscreen views, where I can switch between
I have two tabbar items(views) that use the same data, whats the best solution
I have a Delphi 7 application that has two views of a document (e.g.
At my view I have two menus that I want to make dependent, namely,
I have a two views, 1st is a simple view with some introduction about
The code below plots some simple x-y data, but it has two problems that
I have two views within one .xib (one view for landscape, another for portrait).

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.