1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    15
    Vote Rating
    1
    displaced is on a distinguished road

      0  

    Default Add Button to Horizontally-Scrollable Tab Bar

    Hi,

    I've got a TabPanel with a top-docked tab panel. The tab bar has a standard button added to the left of the tab buttons using the following code:

    Code:
          var tp = component.getComponent('workTabBar') ;
          var btn = Ext.create('Ext.Button',{
                width:50,
                height:30,
                iconCls: 'search',
                ui: 'action',
                iconMask: true,
                style:'position:absolute;top:7px;bottom:auto;left:5px;z-index:0;'
            });
            tp.element.insertFirst(btn.element);
    However, I now need to add extra tabs to the panel. I've set the TabPanel to be horizontally-scrollable, which works fine. However, since the scrollable area is below the added button, the tab buttons scroll behind the added button.

    I've played with the added button's z-index without any luck. Can anyone suggest a way to implement this?

    For reference, here's what it currently looks like:

    tabbar-bad.jpg

    .. and here's an approximation of what I'd like (essentially the scrollable container's left edge should shift to the right of the 'search' button:

    tabbar-good.jpg

    Many thanks,
    Chris


    (PS - I'm pretty amazed at Sencha Touch. I've been a WinForms developer for years whose attempts at moving to the JavaScript-y world of web development has always fizzled out. Sencha's MVC structure, clean controls and excellent functionality has finally made everything click! (Well, not everything, otherwise I wouldn't be here asking for help )

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    38,582
    Vote Rating
    1136
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default

    Every time I have seen someone get more advanced with the tab panel and try to have extra components in the tab bar they always come up with issues and memory leaks. Tab bar doesn't like to have extra items so I always suggest to just use a container with card layout and use a toolbar and then handle the switching yourself.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1

Tags for this Thread