Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext User
    Join Date
    Aug 2007
    Posts
    6
    Vote Rating
    0
    oracle is on a distinguished road

      0  

    Default [CLOSED][3.0rc2] activate and deactivate events in Tab Panel don't have the tabPanel

    [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

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,853
    Vote Rating
    610
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    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.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

Thread Participants: 1