yrkapil
yrkapil

Reputation: 454

Changing views on button click in Sencha Touch

I came across a situation in sencha touch where i need to change from one view to another on click of a button .

My view 1 is a dashboard which displays around 8 icons and on click of each icon different views are shown . So, i placed an home button in the header of those 8 different views and i am trying to get back to the dashboard which is not hapenning .Instead it is showing a blank screen and there was no error displayed in the console for me to check .

My code for changing the view on button click was :

                 {
                        xtype:'button',
                        cls:'clsHome',
                        text:'Home',
                        style: 'background:#4A4245;color:white;',
                        handler: function() {
                            console.log("Home Clicked");                                                
                            var dashboardPanel = Ext.create('AppSupport.view.DashBoard');
                            Ext.Viewport.add(dashboardPanel);
                            //Ext.Viewport.setActiveItem(dashboardPanel,{type: 'slide', direction: 'left'});                              
                        }
                    } 

Help me Guys ... Thanks in Advance ...!!!

Upvotes: 2

Views: 4413

Answers (1)

Ram G Athreya
Ram G Athreya

Reputation: 4952

You should try the Using Navigation View tutorial in sencha architect documentation... It gives a simple step by step guide for view navigation for an app. The navigation view also provides in built history support from sencha touch 2 onwards which also makes going back simple and easy

http://docs.sencha.com/architect/2/#!/guide/navigationview

Upvotes: 2

Related Questions