Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extjs 4 add toolbar to panel dockeditems run-time

Tags:

toolbar

extjs4

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?

like image 568
Asken Avatar asked Jan 19 '23 01:01

Asken


1 Answers

Never mind... was simpler than I thought.

Solution:

panel.addDocked({ ... });
like image 109
Asken Avatar answered Feb 12 '23 09:02

Asken