A1rPun
A1rPun

Reputation: 16847

How can I create a button initially hidden in ExtJS?

I have a toolbar with some buttons and one of the buttons needs to be invisible at creation and visible at some point in my app.

I'm currently adding the button when it needs to be visible but that is not exactly what I want.

Upvotes: 4

Views: 10389

Answers (2)

SharpCoder
SharpCoder

Reputation: 19163

find the button and make it invisible

Ext.create('Ext.toolbar.Toolbar', {
        renderTo: document.body,
        width   : 400,
        items: [
            {
                text: 'Button',
                id: 'my-btn',
                hidden: true
            },
            {
                xtype: 'splitbutton',
                text : 'Split Button'
            },
            '->',
            {
                xtype    : 'textfield',
                name     : 'field1',
                emptyText: 'enter search term'
            }
        ]
    });

Upvotes: 1

dougajmcdonald
dougajmcdonald

Reputation: 20047

When you create the button you can set hidden: true in the config.

Or you can 'hide()' the button soon after adding it and then 'show()' it at a later date.

Upvotes: 8

Related Questions