extjsextjs6-modern

afterrender not work in tbpanel Extjs modern


Afterrender event not work for my tabpanel component. code of my tabpanel:

Ext.define('Admin.view.tabs.Tabs', {
extend: 'Ext.tab.Panel',

shadow: true,
cls: 'demo-solid-background',
tabBar: {
    layout: {
        pack: 'center'
    }
},
activeTab: 1,
defaults: {
    scrollable: true
},
items: [
    {
        title: 'Tab 1',
        html : 'By default, tabs are aligned to the top of a view.',
        cls: 'card'
    },
    {
        title: 'Tab 2',
        html : 'A TabPanel can use different animations by setting <code>layout.animation.</code>',
        cls: 'card'
    }
],
listeners: {
    afterrender: function(corpse) {
        console.log('afterrender');
    }
}});

This tab panel I use in view formpanel that added in main view like this:

doCompose: function (to) {
    var me = this,
        composer = me.composer,
        view = me.getView(),
        viewModel = me.getViewModel(),
        toField;

    me.hideActions();

    if (!composer) {
        me.composer = composer = view.add(
            {
            xtype: 'compose',
            flex: 1                    
        });

        if (to) {
            toField = me.lookupReference('toField');
            toField.setValue(to);
        }

        viewModel.set('composing', true);
    }
}

Compose it's my formpanel which contain tabpanel. I try use example from official templates ExtJs Sencha. View for mobile profile compose email https://github.com/syscobra/extjs-admin-dashboard-template/tree/master/modern/src


Solution

  • As i said Ext-JS 6 modern TabPanel has not afterrender event.Instead you can use painted, heres the FIDDLE

    listeners: {
        painted: function () {
            //your code
        }
    }