1. #1
    Sencha Premium Member
    Join Date
    Apr 2011
    Posts
    48
    Vote Rating
    1
    Answers
    2
    GFI_SI is on a distinguished road

      0  

    Default Answered: How to access tab in a tabpanel and disable / enable ?

    Answered: How to access tab in a tabpanel and disable / enable ?


    I'm creating a new Viewport which is essentially a tabpanel.

    Code:
    var oViewPort = Ext.create('MyApp.view.Viewport');
    My Viewport looks like this

    Code:
    Ext.define('MyApp.view.Viewport', {
           extend: 'Ext.tab.Panel',
           config: {
               fullscreen: true,
            tabBarPosition: 'bottom',
            layout:{
                type: 'card'
            },
               items: [
                   { xtype: 'login', title: 'Login', id: 'login', iconCls: 'login' },
                { xtype: 'profile', title: 'Profile', id: 'profile', iconCls: 'user', disabled: true },
                { xtype: 'settings', title: 'Settings', id: 'settings', iconCls: 'settings', disabled: true }
            ]
        }
    });
    and my Viewport controller looks like this

    Code:
    Ext.define('MyApp.controller.Viewport', {
        extend: 'Ext.app.Controller',
        views: ['Viewport'],
        config: { 
            refs: {
                loginTab : {
                    selector : 'tabpanel panel[id=login]'
                },
                profileTab : {
                    selector : 'tabpanel panel[id=profile]'
                },
                settingsTab : {
                    selector : 'tabpanel panel[id=settings]'
                }
            }
        },
        init: function() {
        var oLoginTab = this.getLoginTab();
        }
        
    });
    When I try var oLoginTab = this.getLoginTab(); oLoginTab comes back as undefined.

    Any help would be gratefully appreciated.

  2. If you are going to use id, which I would recommend not, then you don't have to use

    Code:
    tabpanel panel[id=login]
    as your selector, you can simple use

    Code:
    #login

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    898
    Answers
    3575
    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


    If you are going to use id, which I would recommend not, then you don't have to use

    Code:
    tabpanel panel[id=login]
    as your selector, you can simple use

    Code:
    #login
    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 Premium Member
    Join Date
    Apr 2011
    Posts
    48
    Vote Rating
    1
    Answers
    2
    GFI_SI is on a distinguished road

      0  

    Default


    Sounded promising, but still I get an undefined object back.

    Not having much luck with this at all.

  5. #4
    Sencha Premium Member
    Join Date
    Apr 2011
    Posts
    48
    Vote Rating
    1
    Answers
    2
    GFI_SI is on a distinguished road

      0  

  6. #5
    Sencha User
    Join Date
    Feb 2012
    Posts
    1
    Vote Rating
    0
    kuljit is on a distinguished road

      0  

    Default


    The following works

    Modify the viewport container and use the following syntax

    Code:
    config: {
    		refs : {
    			login : { selector : 'login' },
    			profile : { selector : 'profile' },
    			settings : { selector : 'settings' },
    		}
    	},
    this.getLogin() will then work.

  7. #6
    Sencha Premium Member
    Join Date
    Apr 2011
    Posts
    48
    Vote Rating
    1
    Answers
    2
    GFI_SI is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    If you are going to use id, which I would recommend not, then you don't have to use

    Code:
    tabpanel panel[id=login]
    as your selector, you can simple use

    Code:
    #login
    This doesn't work for me. Marking it as the best answer in this particular situation is misleading.

Thread Participants: 2