Viswa
Viswa

Reputation: 3211

Navigation between Sencha views

I am developing sencha touch application, Which has lots of views and There are lots of navigation between views, I did this using following code

Ext.Viewport.add({
    xtype : 'view2'
});
Ext.Viewport.animateActiveItem(this.getView2(), {
    type : 'slide',
    direction : 'right'
});

But, lets say when a user navigate from view1 to view2 and view2 to view3, From view3 when a user tabs back button i wrote above code to navigate from view3 to view2.

The above code working, but view1 is first coming like a flash and then moving to view2.

Also sometimes white page is coming when navigate between views.

Upvotes: 0

Views: 1096

Answers (1)

SachinGutte
SachinGutte

Reputation: 7055

There's one component provided in sencha touch that is used exactly for this purpose ( to handle multiple view push/pop ) and it is NavigationView. If you refer docs, you'll see there are lot of config options provided that can help you design and maintain views. Greatest thing about navigation view is, you'll get a back button whenever you push a new view.

Basically, the idea is, having a parent view as navigation view and all other view are added as child to this parent. So whenever you add a new child it get push onto stack. And like stack, we can then push or pop view to/from this navigation view.

There's another cool thing about navigation view is that, you don't have to worry about DOM size anymore. With proper config set, sencha touch will remove unused or unnecessary views instantly when they are poped out. That'll help you improve performance of app.

I've used navigation view in almost all my projects having deep view level upto 6-7. It's never a problem when handled properly.

There might be some other problem with current strategy you are following, but you could use navigation view instead and see the difference and I strongly suggest you do.

Upvotes: 1

Related Questions