Sencha route implements browser and Android return button page return

Source: Internet
Author: User

If sencha is not set, it is a framework page. When you click the return key of a browser or Android, the page or the entire program will pop out.
Therefore, you need to implement the route path
I have provided a detailed description on the Internet. I have been studying it for a long time.
First, you must add the historical path at the beginning of main. In app. js
Launch: function (){
// Add the historical path and set main to home.
This. getApplication (). getHistory (). add (Ext. create ('ext. app. action ',{
Url: 'home'
}));
// Initialize main
Ext. create ('mbapeople. view. main', {fullscreen: true });
}
Second, define a route event in the controller.
Routes :{
'Home': 'homedump ',
'Changepass': 'changejump'
},
Home is the name, followed by the method
Changejump: function (){
Var form = this. getChangepassword ();
Ext. Viewport. setActiveItem (form)
},
Homejump: function (){
Var form = this. getMainview ();
Ext. Viewport. setActiveItem (form)
},
Then, it is called in the corresponding button event.
In the changepassword button, the write is not setActiveitem, but history.
OnBtnTap: function (){
This. getApplication (). getHistory (). add (Ext. create ('ext. app. action ',{
Url: 'changepass'
}));
}
You can directly use history. back () on the return button ();
Handler: function (){
History. back ();
}

In this way, when we initialize main, we will find that the home address is localhost/app/# home, and the jump page address is localhost/app/# changepass, which becomes two pages, naturally, return buttons can be implemented.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.