我有一個tabpanel
,並在第一個標籤上有一個按鈕。當我click
在button
,我需要setfocus
第二個標籤和activate
它(如在顯示內容屬於該標籤)。我的代碼如下,我無法setFocus
或activate
該選項卡從Button click event
。激活標籤面板的第二個標籤
Ext.define('MyApp.view.MyTabPanel', {
extend: 'Ext.tab.Panel',
height: 250,
width: 400,
activeTab: 0,
initComponent: function() {
var me = this;
Ext.applyIf(me, {
items: [{
xtype: 'panel',
title: 'Tab 1',
items: [{
xtype: 'button',
text: 'MyButton',
listeners: {
click: {
fn: me.onButtonClick,
scope: me
}
}
}]
}, {
xtype: 'panel',
title: 'Tab 2'
}, {
xtype: 'panel',
title: 'Tab 3'
}]
});
me.callParent(arguments);
},
onButtonClick: function (button, e, options) {
// Set Focus, and activate the 2nd tab
}
});
謝謝,這很有幫助 – 2012-07-16 07:18:12