[CLOSED] TabPanel+TabScrollerMenu+enableTabScroll+Crhome = Black magic

  1. #1

    [CLOSED] TabPanel+TabScrollerMenu+enableTabScroll+Crhome = Black magic

    Hello!

    Ohh... I have strange problem. I don't shure that it's problem to you, but i will try.

    In TabPanel, if enableTabScroll is true and use plugin TabScrollMenu - happens strange problem . The right arrow are transparent, don't working, and covering the cross at tab's strip, that disable closing the last tab.

    Here JS code, that reproducing this problem. Simple activate the last tab by mouse click:

    var panel = new Ext.TabPanel({ 
            buttons         : [],
            enableTabScroll : true, 
        items: [
            {title:"The tab", html:"The tab number 1.", closable: true}, 
            {title:"Tab", html:"The tab number 2.", closable: true}, 
            {title:"Tab", html:"The tab number 3.", closable: true}, 
            {title:"Tab", html:"The tab number 4.", closable: true},
            {title:"Tab", html:"The tab number 5.", closable: true},
            {title:"One more tab", html:"The tab number 6.", closable: true}
        ],plugins: [this.ctl06 = new Ext.ux.TabScrollerMenu({
                    menuPrefixText: "Open tabs"
                })]
        }); 
    var wnd = new Ext.Window({ 
            layout  : 'fit', 
            width   : 386, 
            height  : 350, 
            items   : [panel], 
            modal   : true, 
            title   : 'Finestra', 
            maximizable : true, 
            minimizable : true 
        }); 
    wnd.show();
    After manipulations with arrows left and right in FF the problem will be resolved, but not in Chrome.

    I investigated the problem and found that it is side effect of bugfix in ExtJS 2.2 - [FIXED][2.2] TabPanel enableTabScroll on Safari.

    I tried resolve this problem using overrided method autoScrollTabs of TabPanel (see commented code):

    Ext.override(Ext.TabPanel, 
        {
            autoScrollTabs: function () {
                this.pos = this.tabPosition == 'bottom' ? this.footer : this.header;
                var count = this.items.length,
                    ow = this.pos.dom.offsetWidth,
                    tw = this.pos.dom.clientWidth,
                    wrap = this.stripWrap,
                    wd = wrap.dom,
                    cw = wd.offsetWidth,
                    pos = this.getScrollPos(),
                    l = this.edge.getOffsetsTo(this.stripWrap)[0]   pos;
    
                if (!this.enableTabScroll || cw < 20) { // 20 to prevent display:none issues
                    return;
                }
                if (count == 0 || l <= tw) {
                    // ensure the width is set if there's no tabs
                    wd.scrollLeft = 0;
                    wrap.setWidth(tw);
                    if (this.scrolling) {
                        this.scrolling = false;
                        this.pos.removeClass('x-tab-scrolling');
                        this.scrollLeft.hide();
                        this.scrollRight.hide();
                        // See here: http://extjs.com/forum/showthread.php?t=49308&highlight=isSafari
                        //if (Ext.isAir || Ext.isWebKit) {
                        //    wd.style.marginLeft = '';
                        //    wd.style.marginRight = '';
                        //}
                    }
                } else {
                    if (!this.scrolling) {
                        this.pos.addClass('x-tab-scrolling');
                        // See here: http://extjs.com/forum/showthread.php?t=49308&highlight=isSafari
                        //if (Ext.isAir || Ext.isWebKit) {
                        //    wd.style.marginLeft = '18px';
                        //    wd.style.marginRight = '18px';
                        //}
                    }
                    tw -= wrap.getMargins('lr');
                    wrap.setWidth(tw > 20 ? tw : 20);
                    if (!this.scrolling) {
                        if (!this.scrollLeft) {
                            this.createScrollers();
                        } else {
                            this.scrollLeft.show();
                            this.scrollRight.show();
                        }
                    }
                    this.scrolling = true;
                    if (pos > (l - tw)) { // ensure it stays within bounds
                        wd.scrollLeft = l - tw;
                    } else { // otherwise, make sure the active tab is still visible
                        this.scrollToTab(this.activeTab, false);
                    }
                    this.updateScrollButtons();
                }
            }
        }
    )
    I don't shure that my fix don't reproduce old bugs. Maybe it must be fixed in Ext.ux.TabScrollerMenu, maybe it's must add some listeners to TabPanel.

    Could you do with it something? Maybe you could send bug to ExtJS... but problem occurred due I use user extension - Ext.ux.TabScrollerMenu.

    I attached screenshot with example of this problem.
    Attached Thumbnails Click image for larger version. 

Name:	TabPanelRightArrowBug.JPG 
Views:	432 
Size:	21.0 KB 
ID:	1638  
    Last edited by Daniil; Sep 23, 2010 at 3:13 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Fixed. Works correctly in Chrome also

Similar Threads

  1. [CLOSED] EnableTabScroll property of TabPanel doesn't found
    By Daly_AF in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 06, 2012, 10:26 AM
  2. Ext.Net in Black and White Theme
    By archana in forum 1.x Help
    Replies: 1
    Last Post: Sep 15, 2011, 3:02 AM
  3. TabStrip property enableTabScroll no function
    By vincent in forum 1.x Help
    Replies: 2
    Last Post: Jan 11, 2011, 6:49 AM
  4. Replies: 7
    Last Post: Apr 27, 2010, 8:42 AM
  5. [CLOSED] TabPanel EnableTabScroll
    By methode in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jul 21, 2009, 9:37 AM

Tags for this Thread

Posting Permissions