Extjs 4将工具栏添加到面板dockeditems运行时

发布于 2024-12-20 21:27:13 字数 1315 浏览 0 评论 0原文

我想在创建面板后创建一个停靠项目工具栏:

Ext.onReady(function() {
    Ext.create('Ext.container.Viewport', {
        layout: 'border',
        items: [{
            region: 'center',
            xtype: 'panel',
            listeners: {
                afterrender: function(panel) {
                    //Below gives: Uncaught TypeError: Object #<Object> has no method 'getItemId'
                    panel.dockedItems.add({
                        xtype: 'toolbar',
                        dock: 'bottom',
                        items: [{
                            text: 'adfsadf'
                        }]
                    });
                }
            }
        }, {
            region: 'west',
            title: 'west',
            html: 'west',
            width: 120
        }, {
            region: 'east',
            title: 'east',
            html: 'east',
            width: 120
        }, {
            region: 'north',
            html: 'north',
            title: 'north',
            height: 60
        }, {
            region: 'south',
            html: 'south',
            title: 'south',
            height: 60
        }]
    });
});

错误是:

Uncaught TypeError: Object #<Object> has no method 'getItemId'

关于如何执行此操作的任何想法?

I want to create a dockedItem toolbar after the panel has been created:

Ext.onReady(function() {
    Ext.create('Ext.container.Viewport', {
        layout: 'border',
        items: [{
            region: 'center',
            xtype: 'panel',
            listeners: {
                afterrender: function(panel) {
                    //Below gives: Uncaught TypeError: Object #<Object> has no method 'getItemId'
                    panel.dockedItems.add({
                        xtype: 'toolbar',
                        dock: 'bottom',
                        items: [{
                            text: 'adfsadf'
                        }]
                    });
                }
            }
        }, {
            region: 'west',
            title: 'west',
            html: 'west',
            width: 120
        }, {
            region: 'east',
            title: 'east',
            html: 'east',
            width: 120
        }, {
            region: 'north',
            html: 'north',
            title: 'north',
            height: 60
        }, {
            region: 'south',
            html: 'south',
            title: 'south',
            height: 60
        }]
    });
});

The error is:

Uncaught TypeError: Object #<Object> has no method 'getItemId'

Any ideas on how to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

方圜几里 2024-12-27 21:27:13

没关系...比我想象的要简单。

解决方案:

panel.addDocked({ ... });

Never mind... was simpler than I thought.

Solution:

panel.addDocked({ ... });
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文