Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: third-party
Hi can you please help me in switch a screen. I have two screen 1 and b , but when I click the login button it goes to b screen but i am not able to do that

This is app.js
    Ext.Loader.setConfig({
        enabled: true
    });
    
    Ext.application({
        views: [
            'a',
    		'b'
                ],
    			controller:['AppController'],
        name: 'MyApp',
        
        launch: function() {
            
            Ext.create('MyApp.view.a', {fullscreen: true});
        }
        
    });
    
    
    this is first view a.js
    
    Ext.define('MyApp.view.a', {
        extend: 'Ext.form.Panel',
        
        config: {
            items: [
                {
                    xtype: 'textfield',
                    border: 10,
                    height: 37,
                    label: 'User Name',
                    labelWidth: '40%',
                    name: 'user-name',
                    maxLength: 20
                },
                {
                    xtype: 'passwordfield',
                    height: 28,
                    margin: 10,
                    label: 'Password',
                    labelWidth: '40%',
                    name: 'password'
                },
                {
                    xtype: 'button',
                    centered: true,
                    height: 40,
                    ui: 'action-round',
                    width: 120,
                    text: 'Login',
                    text: 'Login',
    				listeners: {
            tap: function() {
                //alert("You tapped me");
            }
        }
    				
    			
                },
                {
                    xtype: 'button',
                    bottom: 20,
                    centered: true,
                    height: 42,
                    left: 120,
                    margin: 10,
                    padding: '',
                    ui: 'action-round',
                    text: 'Register'
                }
            ]
        }
        
    });
 
    second view b.js
    Ext.define('MyApp.view.b', {
        extend: 'Ext.form.Panel',
        
        config: {
            items: [
               
                {
                    xtype: 'passwordfield',
                    height: 28,
                    margin: 10,
                    label: 'Password',
                    labelWidth: '40%',
                    name: 'password'
                },
                {
                    xtype: 'button',
                    centered: true,
                    height: 40,
                    ui: 'action-round',
                    width: 120,
                    text: 'Login'
                },
                {
                    xtype: 'button',
                    bottom: 20,
                    centered: true,
                    height: 42,
                    left: 120,
                    margin: 10,
                    padding: '',
                    ui: 'action-round',
                    text: 'Register'
                }
            ]
        }
        
    });
    
    what should i change in controller so that it navigate to second screeb on clicking the button login
    
    Ext.define('MyApp.controller.AppController', {
        extend: 'Ext.app.Controller',
        config: {
            refs: {
                Loginform: 'a',
                Registrationform: 'b'
            },
            
            control: {
                "Loginform": {
                    tap: 'onButtonTap'
                }
            }
        },
        
        onButtonTap: function(button, e, options) {
            console.log("Hi");
           // this.getMain().setActiveItem(1);
            
        }
        
    });
[Edit]Code block added[/Edit]
Posted 16-Jan-13 7:08am
Edited 16-Jan-13 7:47am
(no name)136.6K
v2
Comments
Sergey Alexandrovich Kryukov at 16-Jan-13 14:25pm
   
Is it JavaScript? Then add a tag, using "Improve question" above.
And, if this is JavaScript, what could you possibly mean by "screen"?
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 8,478
1 OriginalGriff 6,516
2 Peter Leow 3,567
3 Zoltán Zörgő 3,386
4 Richard MacCutchan 2,397


Advertise | Privacy | Mobile
Web02 | 2.8.150123.1 | Last Updated 16 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100