Mic C
Mic C

Reputation: 561

extjs: get ref for button created with form.buttons?

After creating buttons on a form with buttons: [{ }], which is meant to be shorthand for the whole docked item syntax, inspection shows that form.buttons is null, and the buttons only exist in form.dockedItems. Since .buttons is a Config, shouldn't they be able to be accessed that way? Would be a little easier than diving into docked items or am I being picky? :-) tia

Upvotes: 0

Views: 769

Answers (1)

Evan Trimboli
Evan Trimboli

Reputation: 30082

You can use the down() selector to grab it:

Ext.require('*');

Ext.onReady(function() {

    var panel = Ext.create('Ext.panel.Panel', {
        renderTo: document.body,
        width: 400,
        height: 400,
        buttons: [{
            itemId: 'b1',
            text: 'Foo'
        }]
    });

    console.log(panel.down('#b1'));

});

Upvotes: 1

Related Questions