Q:

Run same code in each tab in extjs

I wish to have the same form panel in each tab of the tabbed pannel. Is there a way that the same code is run for each tab without having to copy the code in the items list since that would be redundant. 

A:

Here is one way to do it - 
You'll normally define a tabpanel and you give multiple panels as an array of items. For each of the panel inside the item, give the same panel container that you define below as the item. 
{
    xtype: 'tabpanel',
    itemId: 'myTabPanel',
    activeTab: 0,
    plain: true,
    items: [{
        xtype: 'panel',
        itemId: 'tab1',
        layout: 'fit',
        title: 'Strategies',
        items: [{
            xtype: 'myTabContainer'
        }],
        tabConfig: {
            xtype: 'tab',
            closable: false
        }
    }, {
        xtype: 'panel',
        itemId: 'tab2',
        layout: 'fit',
        title: 'Action Sets',
        items: [{
            xtype: 'myTabContainer'
        }]
    }],
    listeners: {
        tabchange: 'tabChangeListener' // define this and handle the actions for your tab change event
    }
}

And here is a sample definition of the container/content for the tab. You can note that I'm using the alias for this container "myTabContainer" as xtype in each of the tabs above. This will make sure that the same view is linked to both the tabs.
Ext.define('MyTabContainer', {
            extend: 'Ext.panel.Panel',
            alias: 'widget.myTabContainer',

            requires: [
                // give all required classes
            ],

            viewModel: {
                type: 'dfstrategiesmaincontainer'
            },
            itemId: 'tabContent',
            layout: 'border'

            // Define all other required items and contents
        }

