1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    104
    Vote Rating
    0
    Answers
    4
    izak18 is on a distinguished road

      0  

    Default Answered: TabPanel ActiveItem Error Msg

    Answered: TabPanel ActiveItem Error Msg


    Hi everbyody,

    This is my case, I have a TabPanel, and when I try to load a view with the activeItem configured, it works fine, like this:

    Code:
    documentoView = Ext.extend(Ext.TabPanel,{
            fullscreen: true,
    	activeItem: 1,
    	items: [
    	{
    		layout: 'fit',
    		id : 'tab1',
    		title: 'title 1',
    		items: [formDoc]
    	},
    	{
    		layout: 'fit',
    		id : 'tab2',
    		title: 'title 2',
    		items: [detalleTabPanel]
    	},
    	{
    		layout: 'fit',
    		id : 'tab3',
    		title: 'title 3',
    		items: [planFactPanelPrincipal]
    	}]
    });
    But, in my case, I have to put a listener and not use activeItem config, something like this:

    Code:
    listeners: {		beforerender: function (thisComponent) {
    			if(something){
    					thisComponent.setActiveItem('tab2');
    			}
    		}
    	}
    And I get a error message:

    Code:
    Uncaught TypeError: Cannot call method 'addCls' of undefined
    What can I do?
    Thanks in advance!

  2. Thanks for the reply, my solution was put the setactiveitem in afterrender event, so the slide is ok, because in 'render' was not.

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


    Try passing an index or the actual component instance.
    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
    Mar 2012
    Posts
    104
    Vote Rating
    0
    Answers
    4
    izak18 is on a distinguished road

      0  

    Default


    Thanks for the reply, my solution was put the setactiveitem in afterrender event, so the slide is ok, because in 'render' was not.

Thread Participants: 1

Tags for this Thread