Thank you for reporting this bug. We will make it our priority to review this report.
-
Ext User
[CLOSED][3.0rc2] activate and deactivate events in Tab Panel don't have the tabPanel
Hi all,
i think that the events activate and deactivate should be of the form:
activate : ( Ext.Panel p, TabPanel this )
deactivate : ( Ext.Panel p, TabPanel this )
it's the fastest and cleanest way i found to modify the tabpanel itself on a tab change.
Here is an example of my application: i have to hide the top toolbar when the user clicks on a particular tab
Code:
Ext.app.MyTab = Ext.extend(Ext.Panel, {
initComponent: function(){
this.addEvents({
activate: true,
deactivate: true
});
this.on('activate', this.showTopToolbar, this);
this.on('deactivate', this.hideTopToolbar, this);
},
showTopToolbar: function(panel,tabpanel){
tabpanel.getTopToolbar().hide();
},
hideTopToolbar: function(panel,tabpanel){
tabpanel.getTopToolbar().show();
},
...
});
and the modified method:
Code:
Ext.TabPanel.prototype.setActiveTab = function(item){
item = this.getComponent(item);
if (!item || this.fireEvent('beforetabchange', this, item, this.activeTab) === false) {
return;
}
if (!this.rendered) {
this.activeTab = item;
return;
}
if (this.activeTab != item) {
if (this.activeTab) {
var oldEl = this.getTabEl(this.activeTab);
if (oldEl) {
Ext.fly(oldEl).removeClass('x-tab-strip-active');
}
this.activeTab.fireEvent('deactivate', this.activeTab, this); // added this as argument
}
var el = this.getTabEl(item);
Ext.fly(el).addClass('x-tab-strip-active');
this.activeTab = item;
this.stack.add(item);
this.layout.setActiveItem(item);
if (this.scrolling) {
this.scrollToTab(item, this.animScroll);
}
item.fireEvent('activate', item, this); // added this as argument
this.fireEvent('tabchange', this, item);
}
};
Thanks
-
Items aren't necessarily solely activated by tab panels. You can also easily grab a reference to it by using panel.ownerCt. Regardless, this isn't a bug, marking as closed.
Twitter - @evantrimboli
Former Sencha framework engineer, available for consulting.
As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.