2
votes

So I have been searching everywhere for the past week but I cant find a way to get two "Ext.TabPanel to scroll together.

I am making this page to have Ext.Panel which has two items :

var MyBorderPanel = new Ext.Panel({
    layout: 'border',
    renderTo: 'command_display',
    cls: 'auto-width-tab-strip',
    height:800,
    items: [
    {
        region: 'west',
        title: 'item1: <?=ui::getURLField("item1")?>',
        split: true,
        width: 500,
        minSize: 100,
        maxSize: 900,
        layout: 'fit', // specify layout manager for items
        items:   // this TabPanel is wrapped by another Panel
        baseTab
    },
    {
        region: 'center',
        title: 'item2 : <?=ui::getURLField("item2")?>',
        split: true,
        margins: '0 0 0 0',
        layout: 'fit', // specify layout manager for items
        items:            // this TabPanel is wrapped by another Panel
        compareTab
    }
]
});

These items : baseTab and compareTab are described like :

var baseTab = new Ext.TabPanel({
    border: false, // already wrapped so don't add another border
    activeTab: 0, // second tab initially active
    items: [
    <?php
        $uihelper->perform("InitItem1Iteration");
        $comma = true;
        while($uihelper->hasNext("Item1Iteration"))
        {
            $uihelper->next("Item1Iteration");
    ?>      
    <?=(!$comma?",":"")?>
    {
        title: 'some php code',
        id: 'some php code',
        autoScroll: true,
        contentEl: 'some php code',
    }
    <?php 
    $comma = false;
    } ?>
    ]
});

Similar is the Item2.

Now basically what I want is. that these two tab panels have sroll bars, so I want that whenever I scroll one tabPanel, the other tab panel automatically scrolls along with it.

Is it even possible?

Thanks Andy

2

2 Answers

0
votes

Short answer, should be...

You need to access the scroller item of the specific container that you are interested in.

I would start investigating with something in the line of:

listeners: {
    scroller: {
        scroll: function(scroller, offset) {
            console.log(scroller, offset);
        }
    }
}

I know that containers have scrollers defined, but I do not think that the tabpanel does. So this kind of listener would have to be added to every item (or the item could bubble the event, untested though).

(and of course, once you can capture the scroll event setting the other panel to the same offset shouldn't prove difficult)

Hope that this at least gives you a direction to move in.

0
votes

You want to be looking at the scroller, as mentioned by @zelexir. Here is a fiddle with my example code http://jsfiddle.net/YgTuc/1/ This is for two panels, but should work just the same for panels in a TabPanel.