-
30 Sep 2012 9:39 PM #1
Answered: Forcing the user to particular page.
Answered: Forcing the user to particular page.
Hi,
Say I have the views:
Then in the controller I have some code to do deep linking, so when someone navigates to #purchase/2, it goes to the InStorePurchaseForm form (which is under the PurchaseNav navigation view):Code:Ext.define("test.view.Main", { extend: 'Ext.tab.Panel', xtype: 'mainpanel', requires: [ 'Ext.TitleBar' ], config: { tabBarPosition: 'bottom', items: [ { xtype: 'homenav' }, { xtype: 'purchasenav' }, { xtype: 'accountnav' } ] } }); Ext.define("test.view.PurchaseNav", { extend: 'Ext.navigation.View', xtype: 'purchasenav', requires: [ 'test.view.InStorePurchaseForm', 'test.view.AddCreditForm' ], config: { title: 'Purchase', iconCls: 'star', items: [ { xtype: 'button', text: 'In Store Purchase', margin: '40', handler: function() { this.up('purchasenav').push({ xtype: 'instorepurchaseform' }); }, { xtype: 'button', text: 'Add Credit', margin: '40', handler: function() { this.up('purchasenav').push({ xtype: 'addcreditform' }); } } );
However, this.getMain().setActiveItem(1) just links the user to the PurchaseNav navigation view. How do I push the InStorePurchase view on top?Code:Ext.define('test.controller.Main', { extend: 'Ext.app.Controller', config: { refs: { main: 'mainpanel' }, routes: { 'purchase/:id': 'showPurchaseNav' } }, showPurchaseNav: function(id) { this.getMain().setActiveItem(1); } });
One solution would be to go straight to the InStorePurchaseForm form via:
But then how do you re-add the TitleBar and tabBar at the bottom as the Main view does for you.Code:Ext.Viewport.setActiveItem(Ext.create('coffeepalapp.view.InStorePurchaseForm'), { // other stuff });What comes around goes around
-
Best Answer Posted by coletek
Works now. I must of been using the wrong ref..
-
2 Oct 2012 9:51 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,581
- Vote Rating
- 433
- Answers
- 3100
You would have to setActiveItem(1) on the main view and then push a view to the navigation view.
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.
-
2 Oct 2012 11:08 AM #3
But how do I do that? It keeps saying push() is undefined.
What comes around goes around
-
3 Oct 2012 5:48 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,581
- Vote Rating
- 433
- Answers
- 3100
Then the view you are trying to execute the push method on is not a navigation view
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.
-
9 Oct 2012 1:24 AM #5
Works now. I must of been using the wrong ref..
What comes around goes around


Reply With Quote