-
14 Nov 2012 12:46 AM #1
Answered: Change view in sencha touch 2
Answered: Change view in sencha touch 2
I had make a controller in sencha touch 2 in which i am performing an ajax request.
I want to change the view on suceess.
Currently i am using
var firststep = Ext.create('Myapp.view.Rangeselector'); Ext.getCmp('loginForm').destroy();
Ext.Viewport.add(firststep);
It is destroying loginForm but didn't load Rangeselector view.
Can anyone please give me a solution.
-
Best Answer Posted by Schildi
Hi deepakgarg89,
try this:
It's not enough to just add your view to the viewport, you already have to navigate to itCode:var firststep = Ext.create('Myapp.view.Rangeselector'); Ext.Viewport.setActiveItem(firststep);
Best regards,
Schildi
-
14 Nov 2012 12:55 AM #2
Change view in sencha touch 2
Change view in sencha touch 2
I had make a controller in sencha touch 2 in which i am performing an ajax request.
I want to change the view on suceess.
Currently i am using
var firststep = Ext.create('Myapp.view.Rangeselector');
Ext.getCmp('loginForm').destroy();
Ext.Viewport.add(firststep);
It is destroying loginForm but didn't load Rangeselector view.
Can anyone please give me a solution.
-
14 Nov 2012 3:06 AM #3
Hi deepakgarg89,
try this:
It's not enough to just add your view to the viewport, you already have to navigate to itCode:var firststep = Ext.create('Myapp.view.Rangeselector'); Ext.Viewport.setActiveItem(firststep);
Best regards,
Schildi
-
14 Nov 2012 4:16 AM #4
Hi Schildi,
Hi Schildi,
Thanks for reply, I will use it and than revert back on the same

-
15 Nov 2012 12:45 PM #5Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
- Answers
- 3155
Use setActiveItem method. You can use this method a couple different ways.
You can pass it a component instance or a config object. If it's a config object it will create an instance. If the component instance (created by passing an instance or if it was created via a config object) isn't an item then it will add the instance to the parent. Once that happens then it will make it the active item and display it.Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
15 Nov 2012 12:47 PM #6Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
- Answers
- 3155
Just noticed you posted the same question twice in 2 different forums. Please do not do this, I have merged the threads.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
16 Nov 2012 8:02 PM #7
Thanks for reply mitchell,
Thanks for reply mitchell,
I will take care in future and post only in one forum


Reply With Quote