afterrender在tbpanel Extjs Modern中不起作用

时间:2018-11-06 10:00:03

标签: extjs extjs6-modern

Afterrender事件不适用于我的TabPanel组件。 我的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');
    }
}});

我在视图表单面板中使用的此选项卡面板像这样在主视图中添加:

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);
    }
}

撰写包含制表符的是我的表单面板。 我尝试使用官方模板ExtJs Sencha中的示例。 查看移动个人资料撰写电子邮件https://github.com/syscobra/extjs-admin-dashboard-template/tree/master/modern/src

1 个答案:

答案 0 :(得分:2)

正如我所说的Ext-JS 6现代TabPanel没有afterrender事件。相反,您可以使用painted,这里是 FIDDLE

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