1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    144
    Answers
    19
    Vote Rating
    0
    coletek is on a distinguished road

      0  

    Default Answered: Forcing the user to particular page.

    Answered: Forcing the user to particular page.


    Hi,

    Say I have the views:

    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'
                     });
           	     }
    
          }
    );
    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.controller.Main', {
        extend: 'Ext.app.Controller',
    
    
        config: {
            refs: {
                main: 'mainpanel'
            },
            routes: {
                'purchase/:id': 'showPurchaseNav'
            }
        },
    
    
        showPurchaseNav: function(id) {
            this.getMain().setActiveItem(1);
        }
    
    
    });
    However, this.getMain().setActiveItem(1) just links the user to the PurchaseNav navigation view. How do I push the InStorePurchase view on top?

    One solution would be to go straight to the InStorePurchaseForm form via:

    Code:
    Ext.Viewport.setActiveItem(Ext.create('coffeepalapp.view.InStorePurchaseForm'), {                                                         
                // other stuff                                                                                                                          
    });
    But then how do you re-add the TitleBar and tabBar at the bottom as the Main view does for you.
    What comes around goes around

  2. Works now. I must of been using the wrong ref..

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,522
    Answers
    3447
    Vote Rating
    814
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Sep 2012
    Posts
    144
    Answers
    19
    Vote Rating
    0
    coletek is on a distinguished road

      0  

    Default


    But how do I do that? It keeps saying push() is undefined.
    What comes around goes around

  5. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,522
    Answers
    3447
    Vote Rating
    814
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  6. #5
    Sencha User
    Join Date
    Sep 2012
    Posts
    144
    Answers
    19
    Vote Rating
    0
    coletek is on a distinguished road

      0  

    Default


    Works now. I must of been using the wrong ref..
    What comes around goes around

Thread Participants: 1