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

Ask*_*ken 4 toolbar extjs4

我想在创建面板后创建一个dockedItem工具栏:

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
        }]
    });
});
Run Code Online (Sandbox Code Playgroud)

错误是:

Uncaught TypeError: Object #<Object> has no method 'getItemId'
Run Code Online (Sandbox Code Playgroud)

关于如何做到这一点的任何想法?

Ask*_*ken 9

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

解:

panel.addDocked({ ... });
Run Code Online (Sandbox Code Playgroud)