Maciej Kucharz
Maciej Kucharz

Reputation: 1443

How to hide textfield with label?

I have textfield:

            {
                xtype: 'textfield',
                fieldLabel: 'LBL_EMAIL',
                anchor: '100%',
                listeners: {
                    'render': function(p) {
                        // check certain conditions
                        this.hide()
                    }
                },
            },

"hide()" only hides textbox (without label) and I want hide whole row (textbox and label). Any ideas?

Upvotes: 7

Views: 15777

Answers (6)

David Lipschitz
David Lipschitz

Reputation: 152

In Sencha Architect (v4.3.0.108 and extJS v7.4.0.45), you can add a Render Event Binding and then inside this write:

component.hide();

This will hide the field and its label.

But thanks for your answers. They pointed me in the right direction.

Upvotes: 0

Zorkus
Zorkus

Reputation: 484

Use something like:

yourElement.container.up('div.x-form-item').hide();

Upvotes: 0

Ganesh Satpute
Ganesh Satpute

Reputation: 3941

I had to do following to make it work.

{
    xtype: 'textfield',
    anchor: '100%',
    listeners: {
        'render': function(p) {
            // hide label
            Ext.getCmp('cluster_name').getEl().up('.x-form-item').setDisplayed(false);
        }
    },
},

Upvotes: 2

hAcky
hAcky

Reputation: 37

Ext.getCmp('id of textfield').hide();

Upvotes: 1

Dan
Dan

Reputation: 21

Maciej's answer didn't work more me. Putting this in Ext's defaults did:

Ext.layout.FormLayout.prototype.trackLabels = true;

Upvotes: 2

Maciej Kucharz
Maciej Kucharz

Reputation: 1443

I found a solution, I have to configure the FormLayout with:

trackLabels: true

Upvotes: 8

Related Questions