2
votes

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 ...!!!

1
You need to put all your views in Ext.Container with a card layout and then use the setActiveItem or animateActiveItem function on your container and pass the view your want to activate as an parameter. Try to find some example in the Sencha Touch Kitchen SinkTitouan de Bailleul

1 Answers

2
votes

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