[CLOSED] [1.0] TabPanel - Solution for no TabChange on Page_Load

  1. #1

    [CLOSED] [1.0] TabPanel - Solution for no TabChange on Page_Load

    I thought I would share my solution for stopping the TabChange listener only on Page_Load - I want it to fire any other time.

    As suggested in other posts, I use the BeforeTabChange to stop the firing on the page_load, but I do it by using the single property instead of whether or not something is visible. The 1 issue I ran into with this is that the active tab does not change to active because the setActiveTab function does not run that section of code if BeforeTabChange returns false. So I added a new function to Ext.TabPanel that will set the tab to active.

    markup: (tabs are added and set as active in code-behind)

    <ext:TabPanel ID="tabPanel1" runat="server">
        <Listeners>
            <BeforeTabChange Handler="this.setActiveTabClass(newTab); return false;" Single="true" />
            <TabChange Handler="searchExecuted();" />
        </Listeners>      
    </ext:TabPanel>
    jsScript:

    Ext.override(Ext.TabPanel, {
        setActiveTabClass: function(item) {
            item = this.getComponent(item);
                if(item){
                    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);
                    }
                }
        }
    });
    If anyone has a better solution please let me know.

    Thanks~
    Last edited by geoffrey.mcgill; Jul 07, 2010 at 2:49 AM.
  2. #2

    RE: [1.0] TabPanel - Solution for no TabChange on Page_Load

    Hi,

    May be it is not so good solution but you can try the following TabPanel's listener
    <BeforeTabChange Handler="this.suspendEvents();this.resumeEvents.defer(1, this);" Single="true" />
  3. #3
    Thank You!

    I was not crazy about adding to the Ext.TabPanel.

    Great solution.

Similar Threads

  1. TabStrip and DirectEvents with TabChange
    By HansWapenaar in forum 2.x Help
    Replies: 0
    Last Post: May 23, 2012, 1:21 PM
  2. TabPanel load panel in TabChange
    By naina in forum 1.x Help
    Replies: 1
    Last Post: Aug 02, 2011, 3:43 PM
  3. Tabchange masking help
    By norphos in forum 1.x Help
    Replies: 9
    Last Post: May 19, 2011, 2:41 PM
  4. Tabchange masking
    By norphos in forum 1.x Help
    Replies: 3
    Last Post: May 11, 2011, 6:45 AM
  5. Replies: 3
    Last Post: Oct 17, 2010, 1:22 PM

Posting Permissions