Sencha Touch, How to change the active tabpanel element from a view

Today I tried to set the active element on a tab with a button inside the view and thought about exchanging code, so its already a solved issue. You can see my answer below.

+3
source share
1 answer

(Modified for wiki community response according to SO Q and A)

OP wrote (a):

All you need to do is assign an identifier for the tab, for example, the following code:

Ext.define("appName.view.Main", { extend: 'Ext.tab.Panel', id: 'mainTabPanel',

Then use the following code to extract this tab and set the active item

Ext.getCmp('mainTabPanel').setActiveItem(1);

Hope this helps someone

@Dawesi wrote:

only for those who are looking at this, you can pass in the index, panel identifier or the panel object itself to set the active element

@Proto Bassi wrote:

Ext.getCmp() Ext.Viewport.down(), , . getCmp , . itemId id.

+2

All Articles