extjs - afterrender 在 tbpanel Extjs 现代中不起作用

标签 extjs extjs6-modern

Afterrender 事件不适用于我的选项卡面板组件。 我的选项卡面板的代码:

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

我在 View 表单面板中使用此选项卡面板,它添加到主视图中,如下所示:

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

最佳答案

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

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

关于extjs - afterrender 在 tbpanel Extjs 现代中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53169573/

相关文章:

javascript - 带有自定义 ListItem 的 NestedList

javascript - 我如何在网格面板上打开窗口?

javascript - ExtJs - 从文件字段保存选定的文件

javascript - 控制台错误 : Unrecognized alias: widget. feedform

javascript - ExtJs,防止图像在 Ext.Img 中拉伸(stretch)

javascript - 容器固定位置但仅在水平滚动时

javascript - Sencha 触摸2 : Populating Tree Store with JSON data

javascript - Ext JS 中方向改变时的对话框位置改变

javascript - Chromium如何将拖动和/或按住转换为单击?

javascript - extjs。如何更改 Ext.field.DatePicker 的数据格式