Arindam Mukherjee
Arindam Mukherjee

Reputation: 2285

How to move to another view after clicking a button?

I have a login screen and there is some registration button and login button. When i will press the login button, i should move to registration screen which is basically a panel. How to move that?? Using handler or controller how can i do that?

Here is my senchafiddle link:

SenchaFiddle Link

Please help..

Upvotes: 0

Views: 3892

Answers (1)

Saurabh Verma
Saurabh Verma

Reputation: 1544

First thing to do is to give an action to the button

          action:'submitLogin',

which is handled in the controller.

         refs{
            nav:'#navview',
            submitButton:'button[action=submitLogin]',
               }

          control:{
        submitButton:{
            tap:'submitIt'
        }}

You can take the main view as a navigation view as

      Ext.define('App.view.Main',{

    extend:'Ext.navigation.View',
    xtype:'mainvi',
    requires:['App.view.Login'],
    id:'navview',
    fullscreen:true,
    config:{
    items:[{
        xtype:'login',
    }]
}
});

In this code the login page is placed at navigation view .Now if u want to move to another view u can just switch by pushing another view in the navigation view as

      submitIt:function(){
    this.getNav().push({
        xtype:'registrationscreen'

     });
     }

the above code can be written in the controller by declaring in the refs

where navview is the id of navigation view.

There is another method u can try. there should be one main panel,put all ur views as items in that panel. the layout of the panel should be card so that only one view is shown i.e login view. After clicking the submit button u can move to another view by using the method

         setActiveItem(param);

where param is the index of the view in the panel.

Upvotes: 2

Related Questions